{"record":{"id":"f5d6eb37ea3753ed","repo":"tirth8205/code-review-graph","slug":"path-is-not-a-directory-resolved","errorCode":null,"errorMessage":"Path is not a directory: {resolved}","messagePattern":"Path is not a directory: (.+?)","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"code_review_graph/registry.py","lineNumber":85,"sourceCode":"        \"\"\"Register a repository path.\n\n        Validates that the path contains a ``.git`` or ``.code-review-graph``\n        directory.\n\n        Args:\n            path: Absolute or relative path to the repository root.\n            alias: Optional short alias for the repository.\n            data_dir: Optional external directory for graph database.\n\n        Returns:\n            The registered entry dict.\n\n        Raises:\n            ValueError: If the path is not a valid repository.\n        \"\"\"\n        resolved = Path(path).resolve()\n        if not resolved.is_dir():\n            raise ValueError(f\"Path is not a directory: {resolved}\")\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(\n                f\"Path does not look like a repository \"\n                f\"(no .git, .svn, or .code-review-graph): {resolved}\"\n            )\n\n        with self._lock:\n            # Check for duplicate path\n            str_path = str(resolved)\n            for entry in self._repos:\n                if entry[\"path\"] == str_path:\n                    # Update alias and/or data_dir if provided\n                    if alias:","sourceCodeStart":67,"sourceCodeEnd":103,"githubUrl":"https://github.com/tirth8205/code-review-graph/blob/b58668751ab0c7670c078cf7cbd4d1f5b8e54f81/code_review_graph/registry.py#L67-L103","documentation":"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.","triggerScenarios":"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).","commonSituations":"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).","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."],"exampleFix":"# before\nregistry.register(\"~/projects/myrepo\")  # ~ not expanded\n# after\nfrom pathlib import Path\nregistry.register(Path(\"~/projects/myrepo\").expanduser().resolve())","handlingStrategy":"validation","validationCode":"from pathlib import Path\np = Path(path).expanduser().resolve()\nif not p.is_dir():\n    raise SystemExit(f\"not a directory: {p}\")\nregistry.register(p)","typeGuard":"def is_registerable_dir(path: str | Path) -> bool:\n    from pathlib import Path\n    return Path(path).expanduser().resolve().is_dir()","tryCatchPattern":"try:\n    registry.register(path)\nexcept ValueError as exc:\n    if str(exc).startswith(\"Path is not a directory\"):\n        print(exc); sys.exit(2)","preventionTips":["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."],"tags":["registry","path-validation","filesystem"],"backgroundTag":"path-not-found","analyzedSha":"b58668751ab0c7670c078cf7cbd4d1f5b8e54f81","analyzedAt":"2026-08-28T13:19:08.966Z","schemaVersion":2},"datasetVersion":"2026-08-28T16:17:29.566Z"}