{"record":{"id":"641fbc50025953fa","repo":"tirth8205/code-review-graph","slug":"no-git-svn-or-code-review-graph-directory-in","errorCode":null,"errorMessage":"No .git, .svn, or .code-review-graph directory in {resolved}","messagePattern":"No \\.git, \\.svn, or \\.code-review-graph directory in (.+?)","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"code_review_graph/daemon.py","lineNumber":334,"sourceCode":"\n    Returns:\n        The updated :class:`DaemonConfig`.\n\n    Raises:\n        ValueError: If the path is not a valid repository directory.\n    \"\"\"\n    resolved = Path(repo_path).expanduser().resolve()\n\n    if not resolved.is_dir():\n        raise ValueError(f\"Not a directory: {resolved}\")\n\n    has_repo_marker = (\n        (resolved / \".git\").exists()\n        or (resolved / \".svn\").exists()\n        or (resolved / \".code-review-graph\").exists()\n    )\n    if not has_repo_marker:\n        raise ValueError(f\"No .git, .svn, or .code-review-graph directory in {resolved}\")\n\n    effective_alias = alias or resolved.name\n\n    config = load_config(config_path)\n\n    # Check for duplicate path or alias\n    for existing in config.repos:\n        if existing.path == str(resolved):\n            logger.warning(\"Repo %s is already configured — skipping\", resolved)\n            return config\n        if existing.alias == effective_alias:\n            raise ValueError(f\"Alias '{effective_alias}' is already in use by {existing.path}\")\n\n    config.repos.append(WatchRepo(path=str(resolved), alias=effective_alias))\n    save_config(config, config_path)\n    return config\n\n","sourceCodeStart":316,"sourceCodeEnd":352,"githubUrl":"https://github.com/tirth8205/code-review-graph/blob/b58668751ab0c7670c078cf7cbd4d1f5b8e54f81/code_review_graph/daemon.py#L316-L352","documentation":"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.","triggerScenarios":"Calling daemon add on a plain directory: a fresh `git init`-less folder, a workspace/scratch directory, or a repo exported without VCS metadata.","commonSituations":"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.","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"],"exampleFix":"# before\n$ code-review-graph daemon add ~/src/plain-dir\nValueError: No .git, .svn, or .code-review-graph directory in /home/me/src/plain-dir\n\n# after\n$ cd ~/src/plain-dir && git init\n$ code-review-graph daemon add ~/src/plain-dir","handlingStrategy":"validation","validationCode":"from pathlib import Path\n\nr = Path(repo_path).expanduser().resolve()\nassert r.is_dir() and any((r / m).exists() for m in (\".git\", \".svn\", \".code-review-graph\"))","typeGuard":"from pathlib import Path\n\ndef looks_like_repo(p: str | Path) -> bool:\n    r = Path(p).expanduser().resolve()\n    return r.is_dir() and any(\n        (r / m).exists() for m in (\".git\", \".svn\", \".code-review-graph\")\n    )","tryCatchPattern":"try:\n    add_repo_to_config(repo_path, alias)\nexcept ValueError as e:\n    if \"No .git, .svn\" in str(e):\n        # initialize VCS or pick the correct root directory\n        ...\n    else:\n        raise","preventionTips":["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"],"tags":["daemon","config","repo-detection","valueerror"],"backgroundTag":"not-a-git-repository","analyzedSha":"b58668751ab0c7670c078cf7cbd4d1f5b8e54f81","analyzedAt":"2026-08-28T13:19:08.966Z","schemaVersion":2},"datasetVersion":"2026-08-28T16:17:29.566Z"}