{"record":{"id":"2bcb679f2e4211c1","repo":"Fission-AI/OpenSpec","slug":"could-not-retire-capability-update-id-failed","errorCode":null,"errorMessage":"Could not retire capability '${update.id}': failed to delete ${update.target} (${(error as Error).message}). Remove it by hand, then rerun the archive.","messagePattern":"Could not retire capability '(.+?)': failed to delete (.+?) \\((.+?)\\)\\. Remove it by hand, then rerun the archive\\.","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/core/specs-apply.ts","lineNumber":870,"sourceCode":"          await fs.lstat(update.target);\n          throw new Error(\n            `${error instanceof Error ? error.message : String(error)} ` +\n              `A concurrent file now occupies ${update.target}; the displaced spec was retained at ${displaced}.`\n          );\n        } catch (targetError) {\n          if ((targetError as NodeJS.ErrnoException).code !== 'ENOENT') throw targetError;\n        }\n        await fs.rename(displaced, update.target);\n        throw error;\n      }\n    } else {\n      await fs.unlink(update.target);\n    }\n  } catch (error) {\n    if ((error as NodeJS.ErrnoException).code === 'ENOENT') return { retired: false };\n    // A bare errno here reads as an internal failure; say what was being\n    // attempted so the message is actionable on its own.\n    throw new Error(\n      `Could not retire capability '${update.id}': failed to delete ${update.target} ` +\n        `(${(error as Error).message}). Remove it by hand, then rerun the archive.`\n    );\n  }\n\n  if (!options.deferDelete) {\n    await pruneEmptyDirs(path.dirname(update.target), mainSpecsDir);\n  }\n\n  const nominal = options.displayPath ?? `openspec/specs/${update.id}/spec.md`;\n  if (!options.silent) {\n    console.log(`Retiring ${nominal}: all requirements removed.`);\n  }\n  // `resolvedPath` is always the file that was actually unlinked - callers need\n  // it to report a path git will accept, since the nominal one is built from\n  // the capability id and can differ in case, or point through a symlink.\n  return {\n    retired: true,","sourceCodeStart":852,"sourceCodeEnd":888,"githubUrl":"https://github.com/Fission-AI/OpenSpec/blob/6926ccb18afa4ff621112813e9968334576ee11a/src/core/specs-apply.ts#L852-L888","documentation":"Error \"Could not retire capability '${update.id}': failed to delete ${update.target} (${(error as Error).message}). Remove it by hand, then rerun the archive.\" thrown in Fission-AI/OpenSpec.","triggerScenarios":"Thrown at src/core/specs-apply.ts:870 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"6926ccb18afa4ff621112813e9968334576ee11a","analyzedAt":"2026-08-25T12:29:45.729Z","schemaVersion":2},"datasetVersion":"2026-08-25T16:17:27.014Z"}