{"record":{"id":"ab96c5caaf70f819","repo":"Fission-AI/OpenSpec","slug":"store-setup-non-empty-directory","errorCode":"store_setup_non_empty_directory","errorMessage":"Store setup does not support initializing a non-empty folder that is not a healthy OpenSpec root.","messagePattern":"Store setup does not support initializing a non-empty folder that is not a healthy OpenSpec root\\.","errorType":"error_code","errorClass":"StoreError","httpStatus":null,"severity":"error","filePath":"src/core/store/operations.ts","lineNumber":516,"sourceCode":"        throw new StoreError(\n          `Store metadata id '${metadata.id}' does not match requested id '${id}'.`,\n          'store_metadata_id_mismatch',\n          {\n            target: 'store.metadata',\n            fix: `Use id '${metadata.id}' or choose a different setup path.`,\n          }\n        );\n      }\n      if (input.remote !== undefined) {\n        // Silent acceptance is the forbidden outcome: the identity file\n        // already exists, so --remote cannot reach the committed shape.\n        throw remoteRequiresHandEditError(id, storeRoot);\n      }\n    } else {\n      const openspecRoot = await inspectOpenSpecRoot(storeRoot);\n      const safeFreshDirectory = await isDirectoryEmpty(storeRoot) || await isGitOnlyDirectory(storeRoot);\n      if (!openspecRoot.healthy && !safeFreshDirectory) {\n        throw new StoreError(\n          'Store setup does not support initializing a non-empty folder that is not a healthy OpenSpec root.',\n          'store_setup_non_empty_directory',\n          {\n            target: 'store.root',\n            fix: 'Choose an empty folder, a Git-only folder, or an existing healthy OpenSpec root.',\n          }\n        );\n      }\n    }\n\n    backend = await resolveBackendWithObservedOrigin(storeRoot);\n  }\n\n  const registry = await readStoreRegistryState();\n  const conflictBackend = backend ?? {\n    type: 'git' as const,\n    local_path: FileSystemUtils.canonicalizeExistingPath(storeRoot),\n  };","sourceCodeStart":498,"sourceCodeEnd":534,"githubUrl":"https://github.com/Fission-AI/OpenSpec/blob/6926ccb18afa4ff621112813e9968334576ee11a/src/core/store/operations.ts#L498-L534","documentation":"Thrown by prepareSetupPlan when the setup path is a non-empty folder that holds no readable store metadata and is not a healthy OpenSpec root. Setup can only initialize an empty folder or adopt a valid root; anything else is treated as accidental data loss risk.","triggerScenarios":"Thrown at src/core/store/operations.ts:516 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Empty the folder (or move its contents) before running setup","Point setup at a different, empty path","Initialize a healthy OpenSpec root in the folder first"],"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"}