{"record":{"id":"df172d54d15a981d","repo":"Fission-AI/OpenSpec","slug":"error-instanceof-error-error-message-string","errorCode":null,"errorMessage":"${error instanceof Error ? error.message : String(error)} A concurrent file now occupies ${update.target}; the displaced spec was retained at ${displaced}.","messagePattern":"(.+?) A concurrent file now occupies (.+?); the displaced spec was retained at (.+?)\\.","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/core/specs-apply.ts","lineNumber":853,"sourceCode":"    if (options.verifyDisplaced) {\n      const displaced = `${update.target}.openspec-retire-${randomUUID()}`;\n      displacedPath = displaced;\n      await fs.rename(update.target, displaced);\n      try {\n        await options.verifyDisplaced(displaced);\n        try {\n          await fs.lstat(update.target);\n          throw new Error(\n            `A concurrent file appeared at ${update.target} while archive was retiring it.`\n          );\n        } catch (targetError) {\n          if ((targetError as NodeJS.ErrnoException).code !== 'ENOENT') throw targetError;\n        }\n        if (!options.deferDelete) await fs.unlink(displaced);\n      } catch (error) {\n        try {\n          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} ` +","sourceCodeStart":835,"sourceCodeEnd":871,"githubUrl":"https://github.com/Fission-AI/OpenSpec/blob/6926ccb18afa4ff621112813e9968334576ee11a/src/core/specs-apply.ts#L835-L871","documentation":"Error \"${error instanceof Error ? error.message : String(error)} A concurrent file now occupies ${update.target}; the displaced spec was retained at ${displaced}.\" thrown in Fission-AI/OpenSpec.","triggerScenarios":"Thrown at src/core/specs-apply.ts:853 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"}