Fission-AI/OpenSpec · error · RootSelectionError

Global defaultStore

Error message

Global defaultStore '${id}': ${error.message}

What it means

A rewrapping boundary in resolveDefaultStoreRoot: the machine-wide defaultStore set in global config failed to resolve (stale or unregistered id), and the underlying error is re-thrown prefixed with 'Global defaultStore' so the user knows the global config is the source. The fix is reshaped to point at clearing the global default rather than passing --store.

Solutions

  1. Clear the stale default in global config so resolution falls back to registry/nearest-root
  2. Register the missing store id so the default resolves again
  3. Update defaultStore to a currently registered store id
Defensive patterns

Strategy: try-catch

When it happens

Trigger: Thrown at src/core/root-selection.ts:379 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/476b1bdb76c89292. Report an issue: GitHub.

Appendix: source

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

 * machine-wide default from a repo's `store:` pointer. Mirrors the
 * declared-pointer catch — a stale or unregistered id degrades to the
 * underlying error, reshaped to point at clearing the global default
 * rather than passing --store.
 */
async function resolveDefaultStoreRoot(
  id: string,
  globalDataDir?: string
): Promise<ResolvedOpenSpecRoot> {
  try {
    return await resolveStoreRoot(id, globalDataDir, 'global_default');
  } catch (error) {
    if (error instanceof RootSelectionError) {
      const staleFix =
        error.diagnostic.code === 'unknown_store' ||
        error.diagnostic.code === 'no_registered_stores'
          ? `Register the store (openspec store register <path> --id ${id}) or clear the stale global default (openspec config unset defaultStore).`
          : error.diagnostic.fix;
      throw new RootSelectionError(
        `Global defaultStore '${id}': ${error.message}`,
        error.diagnostic.code,
        {
          ...(error.diagnostic.target ? { target: error.diagnostic.target } : {}),
          ...(staleFix ? { fix: staleFix } : {}),
        }
      );
    }
    throw error;
  }
}

export async function resolveOpenSpecRoot(
  options: ResolveOpenSpecRootOptions = {}
): Promise<ResolvedOpenSpecRoot> {
  if (options.storePath !== undefined) {
    throw new RootSelectionError(
      '--store-path is not supported. Register the path with openspec store register <path>, then select it with --store <id>.',

View on GitHub (pinned to 6926ccb18a)