usestrix/strix · error · ValueError
Diff-scope is active, but no Git repositories were found. Us
Error message
Diff-scope is active, but no Git repositories were found. Use --scope-mode full to disable diff-scope for this run.
What it means
Thrown when diff-scope is explicitly requested (mode 'diff') but none of the provided local sources produced a RepoDiffScope — every source was skipped because it was not a Git repository, or repo-level diff computation failed. In 'auto' mode the same situation returns inactive instead of raising; only explicit 'diff' mode errors. The message points at --scope-mode full as the escape hatch.
Source
Thrown at strix/interface/utils.py:1075
continue
try:
repo_scopes.append(_resolve_repo_diff_scope(source, diff_base, env_map))
except ValueError as e:
if scope_mode == "auto":
skipped_diff_scope.append(f"{source_path} (diff-scope skipped: {e})")
continue
raise
if not repo_scopes:
if scope_mode == "auto":
metadata: dict[str, Any] = {"active": False, "mode": scope_mode}
if skipped_non_git:
metadata["skipped_non_git_sources"] = skipped_non_git
if skipped_diff_scope:
metadata["skipped_diff_scope_sources"] = skipped_diff_scope
return DiffScopeResult(active=False, mode=scope_mode, metadata=metadata)
raise ValueError(
"Diff-scope is active, but no Git repositories were found. "
"Use --scope-mode full to disable diff-scope for this run."
)
instruction_block = build_diff_scope_instruction(repo_scopes)
metadata = {
"active": True,
"mode": scope_mode,
"repos": [scope.to_metadata() for scope in repo_scopes],
"total_repositories": len(repo_scopes),
"total_analyzable_files": sum(len(scope.analyzable_files) for scope in repo_scopes),
"total_deleted_files": sum(len(scope.deleted_files) for scope in repo_scopes),
}
if skipped_non_git:
metadata["skipped_non_git_sources"] = skipped_non_git
if skipped_diff_scope:
metadata["skipped_diff_scope_sources"] = skipped_diff_scope
View on GitHub (pinned to 8551339130)
Solutions
- Run with --scope-mode full if you do not actually need diff-limited scanning.
- Verify each target directory is a Git repo: ls <path>/.git (or git -C <path> status).
- Check that diff_base names a ref that exists in every target repo (git -C <path> rev-parse --verify <diff_base>).
- Use --scope-mode auto so non-Git sources cause graceful deactivation with metadata instead of an error.
Example fix
# CLI - before strix -n -t ./my-folder --scope-mode diff --diff-base main # CLI - after (folder is not a git repo) strix -n -t ./my-folder --scope-mode full
Defensive patterns
Strategy: fallback
Validate before calling
import subprocess
def all_targets_are_git(paths: list[str], diff_base: str) -> bool:
for p in paths:
try:
subprocess.run(["git", "-C", p, "rev-parse", "--verify", diff_base],
check=True, capture_output=True)
except subprocess.CalledProcessError:
return False
return True
if scope_mode == "diff" and not all_targets_are_git(paths, diff_base or "main"):
scope_mode = "full" Type guard
from pathlib import Path
def is_git_working_copy(path: str) -> bool:
return (Path(path) / ".git").exists() Try / catch
try:
result = resolve_diff_scope_context(sources, "diff", base, non_interactive)
except ValueError as e:
if "no Git repositories were found" in str(e):
result = resolve_diff_scope_context(sources, "full", None, non_interactive)
else:
raise Prevention
- Prefer --scope-mode auto unless diff-scope is mandatory for the workflow
- Confirm each target has a .git dir and the diff_base ref exists before the run
- Check result.metadata['skipped_non_git_sources'] / ['skipped_diff_scope_sources'] in auto mode to see why repos were skipped
When it happens
Trigger: scope_mode='diff' with local_sources whose paths are all non-Git directories (skipped_non_git populated), or whose git diff computation against diff_base raised/produced nothing (skipped_diff_scope populated) so repo_scopes stays empty.
Common situations: Pointing the scan at a folder that was copied out of Git (no .git directory); using a diff_base that does not exist in any of the repos (e.g. default branch name mismatch like main vs master); nested worktrees or submodules the check cannot handle.
Related errors
- Diff-scope is active, but no local repository targets were p
- Source is not a git repository: {source_path}
- Unable to resolve a base ref for diff-scope. Pass --diff-bas
- Strix requires full git history for diff-scope. Please set f
- Unable to compute merge-base against '{base_ref}' for '{sour
AI-assisted analysis of usestrix/strix@8551339130 (2026-08-15).
Data as JSON: /api/errors/c65653e10aa0e646.
Report an issue: GitHub.