Fission-AI/OpenSpec · error · RootSelectionError

no_openspec_root

no_openspec_root

Error message

No OpenSpec root found from the current directory.

What it means

A RootSelectionError thrown in resolveOpenSpecRoot when no OpenSpec root exists in the current directory or its ancestors AND the store registry is empty. It is the zero-stores counterpart of the 'registered stores' variant: there is nothing to fall back to and nowhere to point the user except initialization.

Solutions

  1. Run 'openspec init' to create an OpenSpec root in the current project
  2. Register an existing store with 'openspec store register <path>' so it can be selected
  3. Run the command from within a project that already has an OpenSpec root
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at src/core/root-selection.ts:448 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/2957e0263a3a1c60. Report an issue: GitHub.

Appendix: source

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

    fromStoreError(error);
  }
  const registeredIds = registry
    ? listStoreRegistryEntries(registry).map((entry) => entry.id)
    : [];

  if (registeredIds.length > 0) {
    throw new RootSelectionError(
      `No OpenSpec root found in the current directory or its ancestors. Registered stores: ${registeredIds.join(', ')}. Pass --store <id> to use one, or run openspec init to create a local root.`,
      'no_root_with_registered_stores',
      {
        target: 'openspec.root',
        fix: `Rerun with --store <id> (registered: ${registeredIds.join(', ')}) or run openspec init.`,
      }
    );
  }

  if (options.allowImplicitRoot === false) {
    throw new RootSelectionError(
      'No OpenSpec root found from the current directory.',
      'no_openspec_root',
      { target: 'openspec.root', fix: 'Run openspec init to create a root here.' }
    );
  }

  return makeRoot(canonicalDirectory(startPath), 'implicit');
}

// -----------------------------------------------------------------------------
// Output helpers
// -----------------------------------------------------------------------------

export interface RootOutput {
  path: string;
  source: OpenSpecRootSource;
  store_id?: string;
}

View on GitHub (pinned to 6926ccb18a)