Fission-AI/OpenSpec · error · StoreError

store_remove_path_not_directory

store_remove_path_not_directory

Error message

Store path is not a directory: ${storeRoot}

What it means

Safety check inside assertSafeToDeleteStoreRoot during 'openspec store remove': the registered store path exists but is a file (or symlink/non-directory) instead of a directory. The guard refuses destructive removal because the remove operation only deletes directories; the input at fault is the store's registered root path.

Solutions

  1. Run 'openspec store unregister <id>' to forget the registry entry without deleting anything
  2. If the path is a stray file, delete it manually with rm and then unregister the store
  3. Re-register the store with 'openspec store add' pointing at a valid directory
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at src/core/store/operations.ts:915 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/ad9643c766173822. Report an issue: GitHub.

Appendix: source

Thrown at src/core/store/operations.ts:915

    files: {
      deleted: false,
      leftOnDisk: removed.storeRoot,
    },
    diagnostics: [],
  };
}

async function assertSafeToDeleteStoreRoot(storeRoot: string, id: string): Promise<{
  exists: boolean;
}> {
  const kind = await pathKind(storeRoot);

  if (kind === 'missing') {
    return { exists: false };
  }

  if (kind !== 'directory') {
    throw new StoreError(
      `Store path is not a directory: ${storeRoot}`,
      'store_remove_path_not_directory',
      {
        target: 'store.root',
        fix: 'Run "openspec store unregister <id>" if you only want to forget this local registry entry.',
      }
    );
  }

  const metadata = await readStoreMetadataForOperation(storeRoot);
  if (!metadata) {
    throw new StoreError(
      'Store remove refuses to delete a folder without store metadata.',
      'store_remove_metadata_missing',
      {
        target: 'store.metadata',
        fix: 'Run "openspec store unregister <id>" if you only want to forget this local registry entry.',
      }

View on GitHub (pinned to 6926ccb18a)