{"record":{"id":"1d865329bf1af612","repo":"usestrix/strix","slug":"unable-to-resolve-changed-files-for-source-path","errorCode":null,"errorMessage":"Unable to resolve changed files for '{source_path}'. {stderr or 'Ensure the repository has enough history for diff-scope.'}","messagePattern":"Unable to resolve changed files for '(.+?)'\\. (.+?)","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"strix/interface/utils.py","lineNumber":996,"sourceCode":"            f\"Unable to compute merge-base against '{base_ref}' for '{source_path}'. \"\n            \"Ensure the base branch history is fetched and reachable.\"\n        )\n\n    diff_result = _run_git_command_raw(\n        repo_path,\n        [\n            \"diff\",\n            \"--name-status\",\n            \"-z\",\n            \"--find-renames\",\n            \"--find-copies\",\n            f\"{merge_base}...HEAD\",\n        ],\n        check=False,\n    )\n    if diff_result.returncode != 0:\n        stderr = diff_result.stderr.decode(\"utf-8\", errors=\"replace\").strip()\n        raise ValueError(\n            f\"Unable to resolve changed files for '{source_path}'. \"\n            f\"{stderr or 'Ensure the repository has enough history for diff-scope.'}\"\n        )\n\n    entries = _parse_name_status_z(diff_result.stdout)\n    classified = _classify_diff_entries(entries)\n\n    return RepoDiffScope(\n        source_path=source_path,\n        workspace_subdir=workspace_subdir,\n        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    )","sourceCodeStart":978,"sourceCodeEnd":1014,"githubUrl":"https://github.com/usestrix/strix/blob/85513391305171ecc6faffe03da4a8bda5e3febb/strix/interface/utils.py#L978-L1014","documentation":"Raised by _resolve_repo_diff_scope (utils.py:996) when `git diff --name-status -z --find-renames --find-copies <merge_base>...HEAD` exits non-zero after a merge-base was successfully computed. The changed-file listing is the core of diff-scope; failure means git could not produce the diff — typically corrupt/missing objects at the boundary, unreadable paths, or index problems. Git's stderr is embedded when available.","triggerScenarios":"Object store corruption (git fsck errors) between merge-base and HEAD; paths with invalid encoding on the filesystem; a partially-fetched repo where tree/blob objects at the merge-base are missing (partial clone without blob promisor); permission errors reading objects.","commonSituations":"Partial clones (git clone --filter=blob:none) whose lazy object fetch fails offline; repos with exotic filenames hitting core.quotepath/locale issues; interrupted gc leaving dangling packfiles; network loss during on-demand object fetch in CI.","solutions":["Run git fsck to detect corrupt/missing objects; re-clone if corruption is reported","For partial clones, ensure object fetching works: git rev-list --objects --missing=print HEAD, or use a full clone for diff-scope","Read the embedded {stderr} — it names the exact object/path that failed","git gc / git prune to tidy the object store, then re-run"],"exampleFix":"# before\n# partial clone, blob fetch blocked offline\nstrix -t . --diff-scope  # ValueError: Unable to resolve changed files ...\n\n# after\ngit fetch --refetch origin  # or fresh full clone\ngit fsck --full\nstrix -t . --diff-scope --diff-base origin/main","handlingStrategy":"validation","validationCode":"r = subprocess.run([\"git\", \"-C\", repo, \"diff\", \"--name-status\", \"-z\", f\"{merge_base}...HEAD\"], capture_output=True)\nif r.returncode != 0:\n    raise SystemExit(\"git diff failed; run git fsck and re-clone if objects are missing\")","typeGuard":"def diff_computable(repo: str, merge_base: str) -> bool:\n    import subprocess\n    return subprocess.run([\"git\", \"-C\", repo, \"diff\", \"--name-status\", f\"{merge_base}...HEAD\"], capture_output=True).returncode == 0","tryCatchPattern":"try:\n    run_diff_scope_scan()\nexcept ValueError as e:\n    if \"Unable to resolve changed files\" in str(e):\n        repair_object_store()  # git fsck; git fetch --refetch; re-clone if corrupt\n        run_diff_scope_scan()\n    else:\n        raise","preventionTips":["Avoid partial clones (blob filters) for diff-scope unless object fetch is reliable","Run git fsck in CI when diffs fail with missing-object stderr","Keep the object store intact: avoid interrupted gc/prune jobs before scans"],"tags":["git","diff-scope","corruption","partial-clone"],"backgroundTag":null,"analyzedSha":"85513391305171ecc6faffe03da4a8bda5e3febb","analyzedAt":"2026-08-15T05:03:57.275Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}