tirth8205/code-review-graph · error · ValueError
Not a directory: {resolved}
Error message
Not a directory: {resolved} What it means
add_repo_to_config() validates the user-supplied repo path before registering it with the daemon. After expanduser/resolve, it requires the path to be an existing directory; a nonexistent path or a file yields ValueError('Not a directory: ...'). This guards the daemon's watch list against unwatchable entries.
Source
Thrown at code_review_graph/daemon.py:326
config_path: Path | None = None,
) -> DaemonConfig:
"""Add a repository to the daemon config and persist the change.
Args:
repo_path: Path to the repository (will be resolved to absolute).
alias: Optional short name. Derived from dirname if *None*.
config_path: Explicit config file path. Falls back to :func:`default_config_path`.
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 configView on GitHub (pinned to b58668751a)
Solutions
- Check the path exists and is a directory: ls -d <path> before adding
- Use an absolute path or ensure the cwd is correct when passing a relative path
- If the repo truly is missing, clone/restore it first, then retry the add
Example fix
# before $ code-review-graph daemon add ./my-repo-typo ValueError: Not a directory: /home/me/my-repo-typo # after $ code-review-graph daemon add ~/projects/my-repo
Defensive patterns
Strategy: validation
Validate before calling
from pathlib import Path
repo = Path(input_path).expanduser().resolve()
assert repo.is_dir(), f"not a directory: {repo}" Type guard
from pathlib import Path
def is_valid_repo_dir(p: str | Path) -> bool:
r = Path(p).expanduser().resolve()
return r.is_dir() Try / catch
try:
add_repo_to_config(repo_path, alias)
except ValueError as e:
if str(e).startswith("Not a directory"):
# prompt user / log and skip
...
else:
raise Prevention
- Validate paths with Path.is_dir() before calling daemon add
- Prefer absolute paths in scripts to avoid cwd-dependent resolution
- Check for typos and broken symlinks when adds fail
When it happens
Trigger: Calling `code-review-graph daemon add <path>` (or add_repo_to_config directly) with a typo'd path, a path to a file instead of a directory, or a path that does not exist (including broken symlinks after resolve).
Common situations: Typos in CLI arguments, relative paths resolved against an unexpected cwd, moved/deleted repositories, or unexpanded '~' handled incorrectly by the caller.
Related errors
- No .git, .svn, or .code-review-graph directory in {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/64c80c8b74bbae6f.
Report an issue: GitHub.