{"record":{"id":"25b3bb98f0eb73a9","repo":"Fission-AI/OpenSpec","slug":"unhealthy-store-root","errorCode":"unhealthy_store_root","errorMessage":"Store '${id}' does not have a healthy OpenSpec root at ${storeRoot}: ${inspection.problems} ${doctorFix(id)}","messagePattern":"Store '(.+?)' does not have a healthy OpenSpec root at (.+?): (.+?) (.+?)","errorType":"exception","errorClass":"RootSelectionError","httpStatus":null,"severity":"error","filePath":"src/core/root-selection.ts","lineNumber":210,"sourceCode":"  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);\n    default: {\n      // Exhaustiveness guard: a new inspection kind must be handled\n      // here explicitly, not fall through to an undefined root.\n      const unhandled: never = inspection;\n      throw new Error(`Unhandled store inspection kind: ${JSON.stringify(unhandled)}`);\n    }\n  }\n}\n\n/**\n * The metadata-identity and root-health stages of registered-store\n * resolution, as a non-throwing result. `resolveStoreRoot` maps each","sourceCodeStart":192,"sourceCodeEnd":228,"githubUrl":"https://github.com/Fission-AI/OpenSpec/blob/6926ccb18afa4ff621112813e9968334576ee11a/src/core/root-selection.ts#L192-L228","documentation":"A RootSelectionError thrown in resolveStoreRoot when the registered store's root directory exists but fails the health inspection: its contents do not form a valid OpenSpec root (inspection.problems lists specifics). Includes a doctor pointer for repair guidance.","triggerScenarios":"Thrown at src/core/root-selection.ts:210 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Run 'openspec store doctor <id>' to see detailed repair steps","Fix the reported structural problems in the store directory (missing openspec dirs, etc.)","Re-initialize the store with 'openspec store setup' if the directory contents are beyond repair"],"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"}