{"record":{"id":"ad9643c766173822","repo":"Fission-AI/OpenSpec","slug":"store-remove-path-not-directory","errorCode":"store_remove_path_not_directory","errorMessage":"Store path is not a directory: ${storeRoot}","messagePattern":"Store path is not a directory: (.+?)","errorType":"error_code","errorClass":"StoreError","httpStatus":null,"severity":"error","filePath":"src/core/store/operations.ts","lineNumber":915,"sourceCode":"    files: {\n      deleted: false,\n      leftOnDisk: removed.storeRoot,\n    },\n    diagnostics: [],\n  };\n}\n\nasync function assertSafeToDeleteStoreRoot(storeRoot: string, id: string): Promise<{\n  exists: boolean;\n}> {\n  const kind = await pathKind(storeRoot);\n\n  if (kind === 'missing') {\n    return { exists: false };\n  }\n\n  if (kind !== 'directory') {\n    throw new StoreError(\n      `Store path is not a directory: ${storeRoot}`,\n      'store_remove_path_not_directory',\n      {\n        target: 'store.root',\n        fix: 'Run \"openspec store unregister <id>\" if you only want to forget this local registry entry.',\n      }\n    );\n  }\n\n  const metadata = await readStoreMetadataForOperation(storeRoot);\n  if (!metadata) {\n    throw new StoreError(\n      'Store remove refuses to delete a folder without store metadata.',\n      'store_remove_metadata_missing',\n      {\n        target: 'store.metadata',\n        fix: 'Run \"openspec store unregister <id>\" if you only want to forget this local registry entry.',\n      }","sourceCodeStart":897,"sourceCodeEnd":933,"githubUrl":"https://github.com/Fission-AI/OpenSpec/blob/6926ccb18afa4ff621112813e9968334576ee11a/src/core/store/operations.ts#L897-L933","documentation":"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.","triggerScenarios":"Thrown at src/core/store/operations.ts:915 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Run 'openspec store unregister <id>' to forget the registry entry without deleting anything","If the path is a stray file, delete it manually with rm and then unregister the store","Re-register the store with 'openspec store add' pointing at a valid directory"],"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"}