Fission-AI/OpenSpec · error · Error

Cannot fork schema with linked or unsupported entry

Error message

Cannot fork schema with linked or unsupported entry: ${srcPath}

What it means

Thrown during schema fork's recursive copy when an entry cannot be safely copied: it is a symlink or otherwise resolves (via resolveSchemaCopyPath) outside the allowed schema root. Protects the fork from escaping the schema directory through linked entries.

Solutions

  1. Fix or remove the offending entry (often a symlink pointing outside the schema root)
  2. Copy the schema manually excluding the unsupported entry
Defensive patterns

Strategy: try-catch

When it happens

Trigger: Thrown at src/commands/schema.ts:290 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/a15931b04cf185b2. Report an issue: GitHub.

Appendix: source

Thrown at src/commands/schema.ts:290

  }
  ancestors.add(canonicalSrc);
  fs.mkdirSync(dest, { recursive: true });

  try {
    const entries = fs.readdirSync(src, { withFileTypes: true });
    for (const entry of entries) {
      const srcPath = path.join(src, entry.name);
      const destPath = path.join(dest, entry.name);
      const canonicalEntry = resolveSchemaCopyPath(allowedRoot, srcPath);
      const stats = fs.statSync(canonicalEntry);

      if (stats.isDirectory()) {
        copyDirRecursive(canonicalEntry, destPath, allowedRoot, ancestors);
      } else if (stats.isFile()) {
        // Dereference confined links so the fork is an independent schema.
        fs.copyFileSync(canonicalEntry, destPath);
      } else {
        throw new Error(`Cannot fork schema with linked or unsupported entry: ${srcPath}`);
      }
    }
  } finally {
    ancestors.delete(canonicalSrc);
  }
}

/**
 * Verifies a schema tree before replacing or creating the fork destination.
 */
function assertSchemaTreeCanBeCopied(
  src: string,
  allowedRoot = src,
  ancestors = new Set<string>()
): void {
  const canonicalSrc = resolveSchemaCopyPath(allowedRoot, src);
  if (ancestors.has(canonicalSrc)) {
    throw new Error(`Cannot fork schema with a linked directory cycle: ${src}`);

View on GitHub (pinned to 6926ccb18a)