Fission-AI/OpenSpec · error

Could not retire capability

Error message

Could not retire capability '${update.id}': could not verify that ${update.target} is inside ${mainSpecsDir} (${error instanceof Error ? error.message : String(error)}).

What it means

Error "Could not retire capability '${update.id}': could not verify that ${update.target} is inside ${mainSpecsDir} (${error instanceof Error ? error.message : String(error)})." thrown in Fission-AI/OpenSpec.

Solutions

  1. Check permissions on the store directories involved in realpath resolution
  2. Fix any broken symlinks or mount issues on the path between the spec and the main specs dir, then rerun
  3. Move the spec file inside the main specs directory if it legitimately lives outside
Defensive patterns

Strategy: try-catch

When it happens

Trigger: Thrown at src/core/specs-apply.ts:819 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/7b3446fad87292b4. Report an issue: GitHub.

Appendix: source

Thrown at src/core/specs-apply.ts:819

  // claim a file was deleted that is still there.
  let realSource: string | undefined;
  try {
    const link = await fs.lstat(update.target);
    realSource = link.isSymbolicLink() ? undefined : await fs.realpath(update.target);
  } catch (error) {
    if ((error as NodeJS.ErrnoException).code === 'ENOENT') return { retired: false };
    throw new Error(
      `Could not retire capability '${update.id}': could not verify ${update.target} ` +
        `before deletion (${error instanceof Error ? error.message : String(error)}).`
    );
  }

  if (realSource !== undefined) {
    let inside: boolean;
    try {
      inside = await isInsideRealDir(realSource, mainSpecsDir);
    } catch (error) {
      throw new Error(
        `Could not retire capability '${update.id}': could not verify that ${update.target} ` +
          `is inside ${mainSpecsDir} (${error instanceof Error ? error.message : String(error)}).`
      );
    }
    if (!inside) {
      throw new Error(
        `Could not retire capability '${update.id}': ${update.target} resolves outside ` +
          `${mainSpecsDir}. Remove the external file by hand, or replace the symlink and rerun.`
      );
    }
  }

  let displacedPath: string | undefined;
  try {
    await options.beforeMutate?.();
    if (options.verifyDisplaced) {
      const displaced = `${update.target}.openspec-retire-${randomUUID()}`;
      displacedPath = displaced;

View on GitHub (pinned to 6926ccb18a)