{"record":{"id":"c312baa3e76153fd","repo":"usestrix/strix","slug":"unsupported-scope-mode-scope-mode","errorCode":null,"errorMessage":"Unsupported scope mode: {scope_mode}","messagePattern":"Unsupported scope mode: (.+?)","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"strix/interface/utils.py","lineNumber":1025,"sourceCode":"        base_ref=base_ref,\n        merge_base=merge_base,\n        added_files=classified[\"added_files\"],\n        modified_files=classified[\"modified_files\"],\n        renamed_files=classified[\"renamed_files\"],\n        deleted_files=classified[\"deleted_files\"],\n        analyzable_files=classified[\"analyzable_files\"],\n    )\n\n\ndef resolve_diff_scope_context(\n    local_sources: list[dict[str, str]],\n    scope_mode: str,\n    diff_base: str | None,\n    non_interactive: bool,\n    env: dict[str, str] | None = None,\n) -> DiffScopeResult:\n    if scope_mode not in _SUPPORTED_SCOPE_MODES:\n        raise ValueError(f\"Unsupported scope mode: {scope_mode}\")\n\n    env_map = dict(os.environ if env is None else env)\n\n    if scope_mode == \"full\":\n        return DiffScopeResult(\n            active=False,\n            mode=scope_mode,\n            metadata={\"active\": False, \"mode\": scope_mode},\n        )\n\n    if scope_mode == \"auto\":\n        should_activate = _should_activate_auto_scope(local_sources, non_interactive, env_map)\n        if not should_activate:\n            return DiffScopeResult(\n                active=False,\n                mode=scope_mode,\n                metadata={\"active\": False, \"mode\": scope_mode},\n            )","sourceCodeStart":1007,"sourceCodeEnd":1043,"githubUrl":"https://github.com/usestrix/strix/blob/85513391305171ecc6faffe03da4a8bda5e3febb/strix/interface/utils.py#L1007-L1043","documentation":"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.","triggerScenarios":"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).","commonSituations":"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.","solutions":["Set scope_mode to one of 'auto', 'diff', or 'full' (check strix/interface/utils.py:509 _SUPPORTED_SCOPE_MODES for the authoritative set).","If the value comes from user input or config, validate it against {'auto','diff','full'} before calling resolve_diff_scope_context.","If you intended a new mode name, extend _SUPPORTED_SCOPE_MODES and add the matching branch in resolve_diff_scope_context."],"exampleFix":"# before\nresult = resolve_diff_scope_context(sources, scope_mode=\"diffs\", diff_base=\"main\", non_interactive=True)\n\n# after\nresult = resolve_diff_scope_context(sources, scope_mode=\"diff\", diff_base=\"main\", non_interactive=True)","handlingStrategy":"validation","validationCode":"from strix.interface.utils import resolve_diff_scope_context\n\nSUPPORTED = {\"auto\", \"diff\", \"full\"}\n\ndef safe_resolve(sources, mode, base, non_interactive):\n    if mode not in SUPPORTED:\n        raise SystemExit(f\"scope_mode must be one of {sorted(SUPPORTED)}, got {mode!r}\")\n    return resolve_diff_scope_context(sources, mode, base, non_interactive)","typeGuard":"def is_valid_scope_mode(mode: object) -> bool:\n    return isinstance(mode, str) and mode in {\"auto\", \"diff\", \"full\"}","tryCatchPattern":"try:\n    result = resolve_diff_scope_context(sources, mode, base, non_interactive)\nexcept ValueError as e:\n    if str(e).startswith(\"Unsupported scope mode\"):\n        mode = \"auto\"  # or exit with usage message\n        result = resolve_diff_scope_context(sources, mode, base, non_interactive)\n    else:\n        raise","preventionTips":["Centralize scope-mode values as constants shared between CLI parsing and calls","Validate config-file values against the supported set before launching a run"],"tags":["validation","scope-mode","cli","configuration"],"backgroundTag":null,"analyzedSha":"85513391305171ecc6faffe03da4a8bda5e3febb","analyzedAt":"2026-08-15T05:03:57.275Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}