```ts
export function scanPairs(input: string): string[][] {
  if (typeof input !== 'string' || input === '') {
    throw new Error('Input must be a non-empty string');
  }

  const quoted = /"[^"]*"/g;
  let matches = input.match(quoted);
  if (!matches) {
    matches = [];
  }

  const segments = input.split(';').filter(segment => !segment.match(quoted));
  const result: string[][] = [];

  for (const segment of segments) {
    try {
      const pair = parseOption(segment);
      if (!result.some(([key]) => key === pair[0])) {
        result.push(pair);
      } else {
        throw new Error('Duplicate key');
      }
    } catch (e) {
      throw new Error('Invalid options string');
    }
  }

  return result;
}

export function parseOption(segment: string): string[] {
  const parts = segment.split('=');
  if (parts.length !== 2) {
    throw new Error('Invalid option format');
  }

  const key = parts[0];
  if (!/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(key)) {
    throw new Error('Invalid key');
  }

  let value = parts[1].trim();
  if (value.startsWith('"') && value.endsWith('"')) {
    value = value.slice(1, -1);
  }

  return [key, value];
}
```