{"record":{"id":"4811e58c5f13f948","repo":"Fission-AI/OpenSpec","slug":"store-identity-mismatch","errorCode":"store_identity_mismatch","errorMessage":"Store '${id}' is missing identity metadata at ${inspection.metadataPath}. ${doctorFix(id)}","messagePattern":"Store '(.+?)' is missing identity metadata at (.+?)\\. (.+?)","errorType":"error_code","errorClass":"RootSelectionError","httpStatus":null,"severity":"error","filePath":"src/core/root-selection.ts","lineNumber":198,"sourceCode":"        .join(', ')}.`,\n      'unknown_store',\n      {\n        target: 'store.id',\n        fix: 'Pass a registered store id, or run openspec store list.',\n      }\n    );\n  }\n\n  const storeRoot = getStoreRootForBackend(entry.backend);\n  const inspection = await inspectRegisteredStore(id, storeRoot);\n\n  switch (inspection.kind) {\n    case 'metadata_error':\n      return fromStoreError(inspection.error);\n    case 'metadata_missing':\n      // The doctor pointer lives in the message because human-mode command\n      // wrappers print only the message, not the fix field.\n      throw new RootSelectionError(\n        `Store '${id}' is missing identity metadata at ${inspection.metadataPath}. ${doctorFix(id)}`,\n        'store_identity_mismatch',\n        { target: 'store.metadata', fix: doctorFix(id) }\n      );\n    case 'metadata_id_mismatch':\n      throw new RootSelectionError(\n        `Store '${id}' metadata id '${inspection.actualId}' does not match its registered id. ${doctorFix(id)}`,\n        'store_identity_mismatch',\n        { target: 'store.metadata', fix: doctorFix(id) }\n      );\n    case 'unhealthy_root':\n      throw new RootSelectionError(\n        `Store '${id}' does not have a healthy OpenSpec root at ${storeRoot}: ${inspection.problems} ${doctorFix(id)}`,\n        'unhealthy_store_root',\n        { target: 'openspec.root', fix: doctorFix(id) }\n      );\n    case 'ok':\n      return makeRoot(inspection.canonicalRoot, source, id);","sourceCodeStart":180,"sourceCodeEnd":216,"githubUrl":"https://github.com/Fission-AI/OpenSpec/blob/6926ccb18afa4ff621112813e9968334576ee11a/src/core/root-selection.ts#L180-L216","documentation":"A RootSelectionError with code 'store_identity_mismatch', thrown in resolveStoreRoot when a registered store's directory exists but its identity metadata file (at inspection.metadataPath) is absent. The registry entry points at a store whose on-disk marker was deleted or never created. The doctor command reference is embedded in the message because human-mode wrappers print only the message.","triggerScenarios":"Thrown at src/core/root-selection.ts:198 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Run 'openspec store doctor <id>' to diagnose and repair the store's metadata","Re-create the missing metadata file at the reported path","Re-register the store from its actual directory if the store was moved or partially deleted"],"exampleFix":null,"handlingStrategy":"validation","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"}