{"record":{"id":"5fc47fe3daa3f97b","repo":"usestrix/strix","slug":"diff-scope-is-active-but-no-local-repository-targ","errorCode":null,"errorMessage":"Diff-scope is active, but no local repository targets were provided.","messagePattern":"Diff-scope is active, but no local repository targets were provided\\.","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"strix/interface/utils.py","lineNumber":1046,"sourceCode":"\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            )\n\n    if not local_sources:\n        raise ValueError(\"Diff-scope is active, but no local repository targets were provided.\")\n\n    repo_scopes: list[RepoDiffScope] = []\n    skipped_non_git: list[str] = []\n    skipped_diff_scope: list[str] = []\n    for source in local_sources:\n        source_path = source.get(\"source_path\")\n        if not source_path:\n            continue\n        if not _is_git_repo(Path(source_path)):\n            skipped_non_git.append(source_path)\n            continue\n        try:\n            repo_scopes.append(_resolve_repo_diff_scope(source, diff_base, env_map))\n        except ValueError as e:\n            if scope_mode == \"auto\":\n                skipped_diff_scope.append(f\"{source_path} (diff-scope skipped: {e})\")\n                continue\n            raise","sourceCodeStart":1028,"sourceCodeEnd":1064,"githubUrl":"https://github.com/usestrix/strix/blob/85513391305171ecc6faffe03da4a8bda5e3febb/strix/interface/utils.py#L1028-L1064","documentation":"Thrown when diff-scope is active (mode 'diff', or 'auto' that decided to activate) but the local_sources list is empty. Diff-scope needs at least one local Git repository to compute a diff against diff_base; with zero sources there is nothing to diff. The function deliberately refuses to continue rather than silently scanning nothing.","triggerScenarios":"Calling resolve_diff_scope_context(scope_mode='diff', local_sources=[]) — or with sources whose dicts all lack a 'source_path' key; or mode 'auto' in non-interactive runs where _should_activate_auto_scope returned True but no local directory targets were collected (e.g. only a URL or repo target given).","commonSituations":"Running a scan of a remote URL/repo with --scope-mode diff (diff-scope only works on local code targets); a target-list file that yields only non-local targets; passing local_sources entries built with the wrong dict keys.","solutions":["Pass at least one local source dict with a 'source_path' key pointing at a local Git working copy.","If your targets are remote URLs or cloned repos only, disable diff-scope with --scope-mode full.","If you want automatic behavior with remote targets, use --scope-mode auto so it deactivates instead of raising."],"exampleFix":"# before\nresult = resolve_diff_scope_context(local_sources=[], scope_mode=\"diff\", diff_base=\"main\", non_interactive=True)\n\n# after\nresult = resolve_diff_scope_context(\n    local_sources=[{\"source_path\": \"/home/me/project\"}],\n    scope_mode=\"diff\",\n    diff_base=\"main\",\n    non_interactive=True,\n)","handlingStrategy":"validation","validationCode":"local_sources = [s for s in local_sources if s.get(\"source_path\")]\nif scope_mode == \"diff\" and not local_sources:\n    scope_mode = \"full\"  # nothing local to diff; scan fully instead\nresult = resolve_diff_scope_context(local_sources, scope_mode, diff_base, non_interactive)","typeGuard":"def has_local_source(sources: list[dict]) -> bool:\n    return any(isinstance(s.get(\"source_path\"), str) and s[\"source_path\"] for s in sources)","tryCatchPattern":"try:\n    result = resolve_diff_scope_context(sources, mode, base, non_interactive)\nexcept ValueError as e:\n    if \"no local repository targets\" in str(e):\n        result = resolve_diff_scope_context(sources, \"full\", None, non_interactive)\n    else:\n        raise","preventionTips":["Use --scope-mode auto for mixed or remote-only target sets so deactivation is graceful","Build local_sources dicts with the 'source_path' key from the start"],"tags":["validation","diff-scope","git","targets"],"backgroundTag":null,"analyzedSha":"85513391305171ecc6faffe03da4a8bda5e3febb","analyzedAt":"2026-08-15T05:03:57.275Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}