```typescript
export function scanPairs(input: string): string[][] {
  if (typeof input !== 'string') throw new Error("Invalid argument");
  if (input.trim() === '') return [];

  const result: string[][] = [];
  let segments = input.split(/(?<!")semi(;|(?="))/);

  for (const segment of segments) {
    const [key, value] = parseOption(segment);
    if (key && !result.some(([k]) => k === key)) {
      result.push([key, value]);
    }
  }

  return result;
}

function parseOption(segment: string): string[] {
  const parts = segment.split('=');
  let key = parts[0].trim();
  let value = parts.length > 1 ? parts[1].trim() : '';

  // Check if the key is a bare identifier
  if (!/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(key)) {
    throw new Error("Invalid option format");
  }

  // Strip double quotes from the value if it's quoted
  if (value.startsWith('"') && value.endsWith('"')) {
    value = value.slice(1, -1);
  }

  return [key, value];
}
```