Fission-AI/OpenSpec · error · RootSelectionError

unhealthy_store_root

unhealthy_store_root

Error message

Store '${id}' does not have a healthy OpenSpec root at ${storeRoot}: ${inspection.problems} ${doctorFix(id)}

What it means

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.

Solutions

  1. Run 'openspec store doctor <id>' to see detailed repair steps
  2. Fix the reported structural problems in the store directory (missing openspec dirs, etc.)
  3. Re-initialize the store with 'openspec store setup' if the directory contents are beyond repair
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at src/core/root-selection.ts:210 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of Fission-AI/OpenSpec@6926ccb18a (2026-08-25). Data as JSON: /api/errors/25b3bb98f0eb73a9. Report an issue: GitHub.

Appendix: source

Thrown at src/core/root-selection.ts:210

  switch (inspection.kind) {
    case 'metadata_error':
      return fromStoreError(inspection.error);
    case 'metadata_missing':
      // The doctor pointer lives in the message because human-mode command
      // wrappers print only the message, not the fix field.
      throw new RootSelectionError(
        `Store '${id}' is missing identity metadata at ${inspection.metadataPath}. ${doctorFix(id)}`,
        'store_identity_mismatch',
        { target: 'store.metadata', fix: doctorFix(id) }
      );
    case 'metadata_id_mismatch':
      throw new RootSelectionError(
        `Store '${id}' metadata id '${inspection.actualId}' does not match its registered id. ${doctorFix(id)}`,
        'store_identity_mismatch',
        { target: 'store.metadata', fix: doctorFix(id) }
      );
    case 'unhealthy_root':
      throw new RootSelectionError(
        `Store '${id}' does not have a healthy OpenSpec root at ${storeRoot}: ${inspection.problems} ${doctorFix(id)}`,
        'unhealthy_store_root',
        { target: 'openspec.root', fix: doctorFix(id) }
      );
    case 'ok':
      return makeRoot(inspection.canonicalRoot, source, id);
    default: {
      // Exhaustiveness guard: a new inspection kind must be handled
      // here explicitly, not fall through to an undefined root.
      const unhandled: never = inspection;
      throw new Error(`Unhandled store inspection kind: ${JSON.stringify(unhandled)}`);
    }
  }
}

/**
 * The metadata-identity and root-health stages of registered-store
 * resolution, as a non-throwing result. `resolveStoreRoot` maps each

View on GitHub (pinned to 6926ccb18a)