Fission-AI/OpenSpec · error · Error
Cannot fork schema '${source}' onto itself; choose a differe
Error message
Cannot fork schema '${source}' onto itself; choose a different destination name What it means
Error "Cannot fork schema '${source}' onto itself; choose a different destination name" thrown in Fission-AI/OpenSpec.
Source
Thrown at src/commands/schema.ts:748
parseSchema(
fs.readFileSync(path.join(trustedSourceDir, 'schema.yaml'), 'utf-8')
);
// Check destination
const schemasDir = getProjectSchemasDir(projectRoot);
const destinationDir = path.join(schemasDir, destinationName);
// Reject a self-fork. Forking a schema onto itself with --force would
// otherwise remove the source at the replacement step below and then
// fail the copy, destroying the only copy of the schema. Resolve both
// sides to their real paths (realpathSync follows symlinks; path.resolve
// is a fallback only for a destination that does not exist yet) so a
// symlink or a `.`/`..` spelling of the same directory is still caught.
const resolvedDestination = fs.existsSync(destinationDir)
? fs.realpathSync(destinationDir)
: path.resolve(destinationDir);
if (resolvedDestination === trustedSourceDir) {
throw new Error(
`Cannot fork schema '${source}' onto itself; choose a different destination name`
);
}
const destinationExists = fs.existsSync(destinationDir);
if (destinationExists && !options?.force) {
if (options?.json) {
console.log(JSON.stringify({
forked: false,
error: `Schema '${destinationName}' already exists`,
suggestion: 'Use --force to overwrite',
}, null, 2));
} else {
console.error(`Error: Schema '${destinationName}' already exists at ${destinationDir}`);
console.error('Use --force to overwrite');
}
process.exitCode = 1;
return;View on GitHub (pinned to 6926ccb18a)
When it happens
Trigger: Thrown at src/commands/schema.ts:748 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/10cb777c7026564a.
Report an issue: GitHub.