usestrix/strix · error · ValueError

Unsupported scope mode: {scope_mode}

Error message

Unsupported scope mode: {scope_mode}

What it means

Thrown by resolve_diff_scope_context when the scope_mode argument is not one of the supported values {'auto', 'diff', 'full'}. The function is the single entry point for deciding whether a scan runs in diff-scope (only changed files) or full mode, so it validates the mode string before doing anything else. This is a programming/CLI-contract error, not an environmental one.

Source

Thrown at strix/interface/utils.py:1025

        base_ref=base_ref,
        merge_base=merge_base,
        added_files=classified["added_files"],
        modified_files=classified["modified_files"],
        renamed_files=classified["renamed_files"],
        deleted_files=classified["deleted_files"],
        analyzable_files=classified["analyzable_files"],
    )


def resolve_diff_scope_context(
    local_sources: list[dict[str, str]],
    scope_mode: str,
    diff_base: str | None,
    non_interactive: bool,
    env: dict[str, str] | None = None,
) -> DiffScopeResult:
    if scope_mode not in _SUPPORTED_SCOPE_MODES:
        raise ValueError(f"Unsupported scope mode: {scope_mode}")

    env_map = dict(os.environ if env is None else env)

    if scope_mode == "full":
        return DiffScopeResult(
            active=False,
            mode=scope_mode,
            metadata={"active": False, "mode": scope_mode},
        )

    if scope_mode == "auto":
        should_activate = _should_activate_auto_scope(local_sources, non_interactive, env_map)
        if not should_activate:
            return DiffScopeResult(
                active=False,
                mode=scope_mode,
                metadata={"active": False, "mode": scope_mode},
            )

View on GitHub (pinned to 8551339130)

Solutions

  1. Set scope_mode to one of 'auto', 'diff', or 'full' (check strix/interface/utils.py:509 _SUPPORTED_SCOPE_MODES for the authoritative set).
  2. If the value comes from user input or config, validate it against {'auto','diff','full'} before calling resolve_diff_scope_context.
  3. If you intended a new mode name, extend _SUPPORTED_SCOPE_MODES and add the matching branch in resolve_diff_scope_context.

Example fix

# before
result = resolve_diff_scope_context(sources, scope_mode="diffs", diff_base="main", non_interactive=True)

# after
result = resolve_diff_scope_context(sources, scope_mode="diff", diff_base="main", non_interactive=True)
Defensive patterns

Strategy: validation

Validate before calling

from strix.interface.utils import resolve_diff_scope_context

SUPPORTED = {"auto", "diff", "full"}

def safe_resolve(sources, mode, base, non_interactive):
    if mode not in SUPPORTED:
        raise SystemExit(f"scope_mode must be one of {sorted(SUPPORTED)}, got {mode!r}")
    return resolve_diff_scope_context(sources, mode, base, non_interactive)

Type guard

def is_valid_scope_mode(mode: object) -> bool:
    return isinstance(mode, str) and mode in {"auto", "diff", "full"}

Try / catch

try:
    result = resolve_diff_scope_context(sources, mode, base, non_interactive)
except ValueError as e:
    if str(e).startswith("Unsupported scope mode"):
        mode = "auto"  # or exit with usage message
        result = resolve_diff_scope_context(sources, mode, base, non_interactive)
    else:
        raise

Prevention

When it happens

Trigger: Calling resolve_diff_scope_context(local_sources, scope_mode=...) with any string other than 'auto', 'diff', or 'full' — e.g. 'diffs', 'Diff', 'changes', or None passed through as a string. From the CLI, passing an unrecognized --scope-mode value that bypassed argparse choices validation (e.g. built programmatically or a typo in a wrapper script).

Common situations: Typos in automation scripts or CI pipelines that set --scope-mode; version drift where an older/newer Strix version supports a different mode set; passing an enum's raw value instead of its string value.

Related errors


AI-assisted analysis of usestrix/strix@8551339130 (2026-08-15). Data as JSON: /api/errors/c312baa3e76153fd. Report an issue: GitHub.