{"record":{"id":"21c0d86894727fa6","repo":"github/spec-kit","slug":"directory-not-found-source-path","errorCode":null,"errorMessage":"Directory not found: {source_path}","messagePattern":"Directory not found: (.+?)","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"src/specify_cli/commands/init.py","lineNumber":122,"sourceCode":"\n    manager = ExtensionManager(project_path)\n\n    # --- URL ---\n    parsed = urlparse(ext_spec)\n    if parsed.scheme in (\"http\", \"https\"):\n        try:\n            manifest = install_extension_from_url(\n                manager, project_path, ext_spec, speckit_version\n            )\n        except ExtensionError as exc:\n            raise ValueError(str(exc)) from exc\n        return f\"{manifest.name} v{manifest.version} installed\"\n\n    # --- Local path ---\n    if ext_spec.startswith((\"./\", \"../\", \"/\", \"~/\", \".\\\\\", \"..\\\\\")) or Path(ext_spec).is_absolute():\n        source_path = Path(ext_spec).expanduser().resolve()\n        if not source_path.exists():\n            raise ValueError(f\"Directory not found: {source_path}\")\n        if not (source_path / \"extension.yml\").exists():\n            raise ValueError(f\"No extension.yml found in {source_path}\")\n        manifest = manager.install_from_directory(source_path, speckit_version)\n        return f\"{manifest.name} v{manifest.version} installed\"\n\n    # --- Bundled extension name or catalog ID ---\n    bundled_path = _locate_bundled_extension(ext_spec)\n    if bundled_path is not None:\n        if manager.registry.is_installed(ext_spec):\n            return \"already installed\"\n        manifest = manager.install_from_directory(bundled_path, speckit_version)\n        return f\"{manifest.name} v{manifest.version} installed\"\n\n    # Fall back to catalog\n    catalog = ExtensionCatalog(project_path)\n    ext_info, catalog_error = _resolve_catalog_extension(ext_spec, catalog, \"add\")\n    if catalog_error:\n        raise ValueError(f\"Could not query extension catalog: {catalog_error}\")","sourceCodeStart":104,"sourceCodeEnd":140,"githubUrl":"https://github.com/github/spec-kit/blob/bf88c9f9a82fa370c7a7257aa2b3cf10b457b65c/src/specify_cli/commands/init.py#L104-L140","documentation":"When an init extension argument looks like a local path (`./`, `../`, `/`, `~/`, or an absolute path), Spec Kit expands and resolves it, then requires the target to exist. A missing directory becomes ValueError and the corresponding extension step is marked failed.","triggerScenarios":"`specify init --extension ./my-ext` (or ../my-ext, /abs/my-ext, ~/my-ext) when the resolved directory does not exist. The path is resolved from the process's current working directory, not from the new project directory.","commonSituations":"Typo in the directory name, running `specify init` from a different shell directory, or forgetting to clone/create the extension first.","solutions":["Run `ls` on the exact expanded path shown in the error from the same shell where you run specify.","Correct the typo or change to the directory that contains the extension before running init.","Create the extension directory first if it has not been written yet.","Remember that a relative source must start with ./ or ../; a bare name is interpreted as a bundled/catalog extension id."],"exampleFix":"# before\nspecify init demo --extension ./extentions/my-ext\n\n# after\nspecify init demo --extension ./extensions/my-ext","handlingStrategy":"validation","validationCode":"from pathlib import Path\n\ndef extension_source_dir_exists(ext_spec: str) -> bool:\n    if not ext_spec.startswith((\"./\", \"../\", \"/\", \"~/\")) and not Path(ext_spec).is_absolute():\n        return False\n    return Path(ext_spec).expanduser().resolve().exists()","typeGuard":null,"tryCatchPattern":"try:\n    _install_extension_during_init(project_path, ext_spec, version)\nexcept ValueError as exc:\n    if str(exc).startswith(\"Directory not found:\"):\n        prompt_for_correct_extension_path()\n    else:\n        raise","preventionTips":["Run pwd and ls before specifying relative extension paths.","Always prefix local relative sources with ./ or ../.","Script init from the repository root or use absolute paths."],"tags":["init","extensions","filesystem","path"],"backgroundTag":null,"analyzedSha":"bf88c9f9a82fa370c7a7257aa2b3cf10b457b65c","analyzedAt":"2026-08-14T19:43:37.150Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}