Fission-AI/OpenSpec · error
Refusing to write through
Error message
Refusing to write through ${skillDir}: not a real directory. What it means
Safety refusal in prepareSkillDirectory: after mkdir, the expected skill directory path is not a real directory — it exists as a file or resolves through a symlink. The guard prevents writes from being redirected outside outDir.
Solutions
- Remove the file or symlink occupying the skill directory path
- Re-run generation so a real directory can be created
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at scripts/skillssh-shared.mjs:57 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of Fission-AI/OpenSpec@6926ccb18a (2026-08-25).
Data as JSON: /api/errors/64e9ab67f3127207.
Report an issue: GitHub.
Appendix: source
Thrown at scripts/skillssh-shared.mjs:57
if (entry.isDirectory()) {
rmSync(join(outDir, entry.name), { recursive: true, force: true });
}
}
}
/**
* Create `<outDir>/<dirName>` and return its path, guaranteeing the write
* target is a real directory contained in outDir — never a path-traversing
* name and never a symlink that would redirect the write elsewhere.
*/
export function prepareSkillDirectory(outDir, dirName) {
if (!/^[a-z0-9][a-z0-9-]*$/.test(dirName)) {
throw new Error(`Refusing to generate: unsafe skill directory name ${JSON.stringify(dirName)}`);
}
const skillDir = join(outDir, dirName);
mkdirSync(skillDir, { recursive: true });
if (!lstatSync(skillDir).isDirectory()) {
throw new Error(`Refusing to write through ${skillDir}: not a real directory.`);
}
return skillDir;
}
View on GitHub (pinned to 6926ccb18a)