tirth8205/code-review-graph · error · ValueError
Path does not look like a repository (no .git, .svn, or .cod
Error message
Path does not look like a repository (no .git, .svn, or .code-review-graph): {resolved} What it means
register() accepts a directory only if it looks like a repository: it must contain a .git dir, a .svn dir, or a .code-review-graph marker. Otherwise it refuses with this ValueError listing the resolved path.
Source
Thrown at code_review_graph/registry.py:92
alias: Optional short alias for the repository.
data_dir: Optional external directory for graph database.
Returns:
The registered entry dict.
Raises:
ValueError: If the path is not a valid repository.
"""
resolved = Path(path).resolve()
if not resolved.is_dir():
raise ValueError(f"Path is 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"Path does not look like a repository "
f"(no .git, .svn, or .code-review-graph): {resolved}"
)
with self._lock:
# Check for duplicate path
str_path = str(resolved)
for entry in self._repos:
if entry["path"] == str_path:
# Update alias and/or data_dir if provided
if alias:
entry["alias"] = alias
if data_dir:
entry["data_dir"] = str(Path(data_dir).resolve())
self._save()
return entry
new_entry: dict[str, str] = {"path": str_path}View on GitHub (pinned to b58668751a)
Solutions
- If the directory is genuinely a repo, run it from within git (git init / git clone) so .git exists, or re-copy including dotfiles.
- For non-VCS trees you still want tracked, create the marker directory: mkdir .code-review-graph.
- Verify you registered the repo root, not a subdirectory that happens to lack markers.
Example fix
# before
registry.register("/data/plain-source-tree")
# after
mkdir /data/plain-source-tree/.code-review-graph
registry.register("/data/plain-source-tree") Defensive patterns
Strategy: type-guard
Validate before calling
from pathlib import Path
p = Path(path).resolve()
if not any((p / m).exists() for m in (".git", ".svn", ".code-review-graph")):
(p / ".code-review-graph").mkdir(exist_ok=True) # opt in explicitly Type guard
def looks_like_repo(path: Path) -> bool:
p = path.resolve()
return p.is_dir() and any((p / m).exists() for m in (".git", ".svn", ".code-review-graph")) Try / catch
try:
registry.register(path)
except ValueError as exc:
if "does not look like a repository" in str(exc):
(path / ".code-review-graph").mkdir(exist_ok=True)
registry.register(path) Prevention
- Clone repos properly rather than copying without dotfiles.
- Create the .code-review-graph marker directory for non-VCS trees you intend to track.
- Check markers with a helper before calling register().
When it happens
Trigger: Calling register() on an ordinary directory that has none of the three markers — e.g. a plain source folder, a mounted volume, or a repo copied without its .git directory.
Common situations: Registering extracted source tarballs or docker volume mounts that lack VCS metadata; copying a repo with 'cp -r' excluding dotfiles; trying to register a workspace folder before git init.
Related errors
AI-assisted analysis of tirth8205/code-review-graph@b58668751a (2026-08-28).
Data as JSON: /api/errors/41257fe009ec9e39.
Report an issue: GitHub.