{"record":{"id":"f64e2c3b47189f21","repo":"JuliusBrussee/caveman","slug":"source-does-not-exist-input","errorCode":null,"errorMessage":"source does not exist: ${input}","messagePattern":"source does not exist: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/cli/src/index.ts","lineNumber":1575,"sourceCode":"\tschema: \"caveman.skill-import.v1\";\n\tid: string;\n\tsource_sha256: string;\n\tactivation: { status: string; basis: string };\n\tentry_condition: { status: string; value?: string };\n\tstop_condition: { status: string; value?: string };\n\tprompt: { bytes: number; byte_budget: number; status: string };\n\tresources: { scripts: string[]; references: string[]; assets: string[]; status: string };\n\ttransformations: { exact_duplicate_blocks_removed: number; decorative_separators_removed: number };\n\tconflicts: { status: \"needs_review\"; declared: string[] };\n\tbenchmarks: { status: \"required\"; fixtures: string[] };\n\tevidence_status: \"unevaluated\";\n\tpublication: { status: \"blocked\"; blockers: string[] };\n};\n\nfunction importedSkillSource(input: string): { root: string; file: string } {\n\tlet resolved: string;\n\ttry { resolved = realpathSync(resolve(process.cwd(), expandTilde(input))); } catch {\n\t\tthrow new Error(`source does not exist: ${input}`);\n\t}\n\tconst stat = lstatSync(resolved);\n\tconst file = stat.isDirectory() ? join(resolved, SKILL_MD) : resolved;\n\tif (!stat.isDirectory() && basename(resolved) !== SKILL_MD) throw new Error(\"source file must be named SKILL.md\");\n\tif (!hasFile(file)) throw new Error(`SKILL.md missing under ${resolved}`);\n\treturn { root: stat.isDirectory() ? resolved : dirname(resolved), file };\n}\n\nfunction cavemannifyImportedSkill(bytes: Buffer): { body: string; removedDuplicates: number; removedSeparators: number } {\n\tif (bytes.length === 0 || bytes.length > 256 * 1024) throw new Error(\"SKILL.md must be 1..262144 bytes\");\n\tif (bytes.includes(0)) throw new Error(\"SKILL.md contains NUL bytes\");\n\tconst text = bytes.toString(\"utf8\");\n\tif (!Buffer.from(text, \"utf8\").equals(bytes)) throw new Error(\"SKILL.md must be valid UTF-8\");\n\tif (/-----BEGIN [A-Z ]*PRIVATE KEY-----|\\b(?:sk|ghp|github_pat|xox[baprs])[-_][A-Za-z0-9_-]{16,}/i.test(text)) {\n\t\tthrow new Error(\"SKILL.md contains credential-shaped material\");\n\t}\n\tconst split = splitSkillMarkdown(bytes);\n\tif (!split) throw new Error(\"SKILL.md needs closed YAML frontmatter\");","sourceCodeStart":1557,"sourceCodeEnd":1593,"githubUrl":"https://github.com/JuliusBrussee/caveman/blob/3ee70a102609e550bd2e68004bf5990a9341c851/packages/cli/src/index.ts#L1557-L1593","documentation":"importedSkillSource resolves the user-supplied skill source path against the current working directory (after tilde expansion) and calls realpathSync. If the path cannot be resolved — because it does not exist, is unreachable, or realpath fails — this error is thrown naming the original input.","triggerScenarios":"Running the skill-import CLI command with a path like ./skills/my-skill or ~/skills/foo that does not exist on disk, contains a broken symlink, or has a permission problem on a parent directory.","commonSituations":"Typos in the path; running from the wrong working directory; deleted or moved skill folders; broken symlinks; Windows/POSIX path confusion; tilde not expanded because it was quoted.","solutions":["Verify the path exists with ls before importing (remember it is resolved relative to process.cwd())","Use an absolute path or correct relative path from the current directory","If using ~, quote-free tilde expansion should work, but prefer the explicit home path","Check for broken symlinks and recreate them","Check read/execute permissions on every path component"],"exampleFix":"// before\nimportSkillSource(\"./skils/my-skill\");\n// after\nimportSkillSource(\"./skills/my-skill\");","handlingStrategy":"validation","validationCode":"import { existsSync, realpathSync } from \"node:fs\";\nconst abs = resolve(process.cwd(), expandTilde(input));\nif (!existsSync(abs)) throw new Error(\"source path does not exist: \" + abs);","typeGuard":"null","tryCatchPattern":"try { const src = importedSkillSource(input); ... } catch (e) { if (e.message.startsWith(\"source does not exist:\")) { console.error(\"Check the path; cwd=\" + process.cwd()); process.exitCode = 1; } else throw e; }","preventionTips":["Tab-complete paths in the shell to avoid typos","Remember the path resolves relative to the CLI's working directory","Check for broken symlinks with ls -l","Expand ~ explicitly in scripts"],"tags":["filesystem","path","cli"],"backgroundTag":"file-not-found","analyzedSha":"3ee70a102609e550bd2e68004bf5990a9341c851","analyzedAt":"2026-09-20T15:53:39.229Z","contentChangedAt":"2026-09-20T15:53:39.229Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}