tirth8205/code-review-graph · error · ValueError
Path is not a directory: {resolved}
Error message
Path is not a directory: {resolved} What it means
Registry.register() resolves the given path and requires it to be an existing directory before treating it as a repository. A missing dir, a file, or a symlink to a nonexistent target produces this ValueError with the resolved absolute path.
Source
Thrown at code_review_graph/registry.py:85
"""Register a repository path.
Validates that the path contains a ``.git`` or ``.code-review-graph``
directory.
Args:
path: Absolute or relative path to the repository root.
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:View on GitHub (pinned to b58668751a)
Solutions
- Check the resolved path in the error message — fix typos or cd-relative path assumptions.
- If the path is an archive, extract it first and register the extracted directory.
- Pass an absolute path constructed with Path(...).resolve() to avoid cwd surprises.
Example fix
# before
registry.register("~/projects/myrepo") # ~ not expanded
# after
from pathlib import Path
registry.register(Path("~/projects/myrepo").expanduser().resolve()) Defensive patterns
Strategy: validation
Validate before calling
from pathlib import Path
p = Path(path).expanduser().resolve()
if not p.is_dir():
raise SystemExit(f"not a directory: {p}")
registry.register(p) Type guard
def is_registerable_dir(path: str | Path) -> bool:
from pathlib import Path
return Path(path).expanduser().resolve().is_dir() Try / catch
try:
registry.register(path)
except ValueError as exc:
if str(exc).startswith("Path is not a directory"):
print(exc); sys.exit(2) Prevention
- Expand ~ and resolve paths before passing to register().
- Verify archives are extracted before registration.
- Log the resolved path in your own wrapper for easier diagnosis.
When it happens
Trigger: Calling register('/path/that/does/not/exist') or registering a path that is actually a file (e.g. pointing at a README or archive instead of its extracted directory).
Common situations: Typos in repo paths; passing an archive file instead of extracting it first; broken symlinks; scripts using relative paths from an unexpected cwd (the message shows the resolved path, making this obvious).
Related errors
- Not a directory: {resolved}
- watch update failed
- Path does not look like a repository (no .git, .svn, or .cod
- refusing to remove the JSON document root
AI-assisted analysis of tirth8205/code-review-graph@b58668751a (2026-08-28).
Data as JSON: /api/errors/f5d6eb37ea3753ed.
Report an issue: GitHub.