tirth8205/code-review-graph · error · ValueError
No .git, .svn, or .code-review-graph directory in {resolved}
Error message
No .git, .svn, or .code-review-graph directory in {resolved} What it means
Beyond being a directory, add_repo_to_config requires the directory to look like a repository by containing a .git, .svn, or .code-review-graph marker. Without one it raises ValueError, because the daemon's indexer assumes it is watching a VCS checkout it can attribute changes in.
Source
Thrown at code_review_graph/daemon.py:334
Returns:
The updated :class:`DaemonConfig`.
Raises:
ValueError: If the path is not a valid repository directory.
"""
resolved = Path(repo_path).expanduser().resolve()
if not resolved.is_dir():
raise ValueError(f"Not a directory: {resolved}")
has_repo_marker = (
(resolved / ".git").exists()
or (resolved / ".svn").exists()
or (resolved / ".code-review-graph").exists()
)
if not has_repo_marker:
raise ValueError(f"No .git, .svn, or .code-review-graph directory in {resolved}")
effective_alias = alias or resolved.name
config = load_config(config_path)
# Check for duplicate path or alias
for existing in config.repos:
if existing.path == str(resolved):
logger.warning("Repo %s is already configured — skipping", resolved)
return config
if existing.alias == effective_alias:
raise ValueError(f"Alias '{effective_alias}' is already in use by {existing.path}")
config.repos.append(WatchRepo(path=str(resolved), alias=effective_alias))
save_config(config, config_path)
return config
View on GitHub (pinned to b58668751a)
Solutions
- If it is meant to be a repo, run `git init` (or build the graph once so .code-review-graph exists), then retry
- Point the add at the actual repository root that contains .git, not a container directory
- For non-VCS trees, run `code-review-graph build` inside the directory first to create the .code-review-graph marker
Example fix
# before $ code-review-graph daemon add ~/src/plain-dir ValueError: No .git, .svn, or .code-review-graph directory in /home/me/src/plain-dir # after $ cd ~/src/plain-dir && git init $ code-review-graph daemon add ~/src/plain-dir
Defensive patterns
Strategy: validation
Validate before calling
from pathlib import Path
r = Path(repo_path).expanduser().resolve()
assert r.is_dir() and any((r / m).exists() for m in (".git", ".svn", ".code-review-graph")) Type guard
from pathlib import Path
def looks_like_repo(p: str | Path) -> bool:
r = Path(p).expanduser().resolve()
return r.is_dir() and any(
(r / m).exists() for m in (".git", ".svn", ".code-review-graph")
) Try / catch
try:
add_repo_to_config(repo_path, alias)
except ValueError as e:
if "No .git, .svn" in str(e):
# initialize VCS or pick the correct root directory
...
else:
raise Prevention
- Target the repository root (the dir containing .git), not a container folder
- git init new projects before registering them with the daemon
- For non-VCS trees, run `code-review-graph build` first to create the marker
When it happens
Trigger: Calling daemon add on a plain directory: a fresh `git init`-less folder, a workspace/scratch directory, or a repo exported without VCS metadata.
Common situations: Adding a source tree copied without .git, a detached archive export, or accidentally targeting a parent folder that merely contains repos instead of a repo itself.
Related errors
- Not a directory: {resolved}
- Alias '{effective_alias}' is already in use by {existing.pat
- Unknown embedding provider '{name}'. Valid: local, openai, g
- Missing required environment variable(s) for the OpenAI embe
- MINIMAX_API_KEY environment variable is required for the Min
AI-assisted analysis of tirth8205/code-review-graph@b58668751a (2026-08-28).
Data as JSON: /api/errors/641fbc50025953fa.
Report an issue: GitHub.