JuliusBrussee/caveman · error
source does not exist
Error message
source does not exist: ${input} What it means
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.
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
Example fix
// before
importSkillSource("./skils/my-skill");
// after
importSkillSource("./skills/my-skill"); Defensive patterns
Strategy: validation
Validate before calling
import { existsSync, realpathSync } from "node:fs";
const abs = resolve(process.cwd(), expandTilde(input));
if (!existsSync(abs)) throw new Error("source path does not exist: " + abs); Type guard
null
Try / catch
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; } Prevention
- 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
When it happens
Trigger: 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.
Common situations: 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.
Understand the failure class
Background: "File not found" and ENOENT errors: why libraries can't find a file that should exist — this error's family across 50 libraries.
Related errors
- is unavailable; repair host installation first
- not found on PATH
- resolve sqlite parent
- caveman-cloud MCP changed after setup; refusing destructive…
- caveman-cloud MCP changed during interrupted setup…
AI-assisted analysis of JuliusBrussee/caveman@3ee70a1026 (2026-09-20).
Data as JSON: /api/errors/f64e2c3b47189f21.
Report an issue: GitHub.
Appendix: source
Thrown at packages/cli/src/index.ts:1575
schema: "caveman.skill-import.v1";
id: string;
source_sha256: string;
activation: { status: string; basis: string };
entry_condition: { status: string; value?: string };
stop_condition: { status: string; value?: string };
prompt: { bytes: number; byte_budget: number; status: string };
resources: { scripts: string[]; references: string[]; assets: string[]; status: string };
transformations: { exact_duplicate_blocks_removed: number; decorative_separators_removed: number };
conflicts: { status: "needs_review"; declared: string[] };
benchmarks: { status: "required"; fixtures: string[] };
evidence_status: "unevaluated";
publication: { status: "blocked"; blockers: string[] };
};
function importedSkillSource(input: string): { root: string; file: string } {
let resolved: string;
try { resolved = realpathSync(resolve(process.cwd(), expandTilde(input))); } catch {
throw new Error(`source does not exist: ${input}`);
}
const stat = lstatSync(resolved);
const file = stat.isDirectory() ? join(resolved, SKILL_MD) : resolved;
if (!stat.isDirectory() && basename(resolved) !== SKILL_MD) throw new Error("source file must be named SKILL.md");
if (!hasFile(file)) throw new Error(`SKILL.md missing under ${resolved}`);
return { root: stat.isDirectory() ? resolved : dirname(resolved), file };
}
function cavemannifyImportedSkill(bytes: Buffer): { body: string; removedDuplicates: number; removedSeparators: number } {
if (bytes.length === 0 || bytes.length > 256 * 1024) throw new Error("SKILL.md must be 1..262144 bytes");
if (bytes.includes(0)) throw new Error("SKILL.md contains NUL bytes");
const text = bytes.toString("utf8");
if (!Buffer.from(text, "utf8").equals(bytes)) throw new Error("SKILL.md must be valid UTF-8");
if (/-----BEGIN [A-Z ]*PRIVATE KEY-----|\b(?:sk|ghp|github_pat|xox[baprs])[-_][A-Za-z0-9_-]{16,}/i.test(text)) {
throw new Error("SKILL.md contains credential-shaped material");
}
const split = splitSkillMarkdown(bytes);
if (!split) throw new Error("SKILL.md needs closed YAML frontmatter");View on GitHub (pinned to 3ee70a1026)