{"record":{"id":"7b3446fad87292b4","repo":"Fission-AI/OpenSpec","slug":"could-not-retire-capability-update-id-could-7b3446","errorCode":null,"errorMessage":"Could not retire capability '${update.id}': could not verify that ${update.target} is inside ${mainSpecsDir} (${error instanceof Error ? error.message : String(error)}).","messagePattern":"Could not retire capability '(.+?)': could not verify that (.+?) is inside (.+?) \\((.+?)\\)\\.","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/core/specs-apply.ts","lineNumber":819,"sourceCode":"  // claim a file was deleted that is still there.\n  let realSource: string | undefined;\n  try {\n    const link = await fs.lstat(update.target);\n    realSource = link.isSymbolicLink() ? undefined : await fs.realpath(update.target);\n  } catch (error) {\n    if ((error as NodeJS.ErrnoException).code === 'ENOENT') return { retired: false };\n    throw new Error(\n      `Could not retire capability '${update.id}': could not verify ${update.target} ` +\n        `before deletion (${error instanceof Error ? error.message : String(error)}).`\n    );\n  }\n\n  if (realSource !== undefined) {\n    let inside: boolean;\n    try {\n      inside = await isInsideRealDir(realSource, mainSpecsDir);\n    } catch (error) {\n      throw new Error(\n        `Could not retire capability '${update.id}': could not verify that ${update.target} ` +\n          `is inside ${mainSpecsDir} (${error instanceof Error ? error.message : String(error)}).`\n      );\n    }\n    if (!inside) {\n      throw new Error(\n        `Could not retire capability '${update.id}': ${update.target} resolves outside ` +\n          `${mainSpecsDir}. Remove the external file by hand, or replace the symlink and rerun.`\n      );\n    }\n  }\n\n  let displacedPath: string | undefined;\n  try {\n    await options.beforeMutate?.();\n    if (options.verifyDisplaced) {\n      const displaced = `${update.target}.openspec-retire-${randomUUID()}`;\n      displacedPath = displaced;","sourceCodeStart":801,"sourceCodeEnd":837,"githubUrl":"https://github.com/Fission-AI/OpenSpec/blob/6926ccb18afa4ff621112813e9968334576ee11a/src/core/specs-apply.ts#L801-L837","documentation":"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.","triggerScenarios":"Thrown at src/core/specs-apply.ts:819 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Check permissions on the store directories involved in realpath resolution","Fix any broken symlinks or mount issues on the path between the spec and the main specs dir, then rerun","Move the spec file inside the main specs directory if it legitimately lives outside"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"6926ccb18afa4ff621112813e9968334576ee11a","analyzedAt":"2026-08-25T12:29:45.729Z","contentChangedAt":"2026-08-25T12:29:45.729Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}