```python
import re


def parse_option(segment: str) -> list:
    key, eq, raw = segment.partition("=")
    if not eq or re.fullmatch(r"[A-Za-z][A-Za-z0-9_]*", key) is None:
        raise ValueError("malformed option segment: " + segment)
    if len(raw) >= 2 and raw.startswith('"') and raw.endswith('"'):
        raw = raw[1:-1]
    return [key, raw]


def scan_pairs(text: str) -> list:
    if not isinstance(text, str):
        raise ValueError("text must be a string")
    if not text:
        raise ValueError("text must not be empty")

    segments = []
    current_segment = []
    in_quotes = False
    quote_char = None

    for char in text:
        if in_quotes:
            if char == quote_char:
                in_quotes = False
            current_segment.append(char)
        else:
            if char == ';':
                segments.append(''.join(current_segment))
                current_segment = []
            elif char in ('"', "'"):
                in_quotes = True
                quote_char = char
                current_segment.append(char)
            else:
                current_segment.append(char)

    if in_quotes:
        raise ValueError("unterminated quoted value")

    segments.append(''.join(current_segment))

    result = []
    seen_keys = set()

    for segment in segments:
        if not segment:
            continue
        key, value = parse_option(segment)
        if key in seen_keys:
            raise ValueError(f"duplicate key: {key}")
        seen_keys.add(key)
        result.append([key, value])

    return result
```