{"record":{"id":"93047b7bbc6796a7","repo":"JuliusBrussee/caveman","slug":"create-s-w","errorCode":null,"errorMessage":"create %s: %w","messagePattern":"create (.+?): %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"mem/store.go","lineNumber":102,"sourceCode":"\n// Options configures Open.\ntype Options struct {\n\t// Dir is the data directory; default ~/.caveman/mem (honoring CAVEMAN_HOME).\n\tDir string\n\t// InMemory uses an ephemeral database for both memories and CCR (tests).\n\tInMemory bool\n}\n\n// Open opens (creating if needed) a cavemem store.\nfunc Open(opts Options) (*Store, error) {\n\tmemPath, ccrPath := \":memory:\", \":memory:\"\n\tif !opts.InMemory {\n\t\tdir := opts.Dir\n\t\tif dir == \"\" {\n\t\t\tdir = defaultDir()\n\t\t}\n\t\tif err := os.MkdirAll(dir, 0o700); err != nil {\n\t\t\treturn nil, fmt.Errorf(\"create %s: %w\", dir, err)\n\t\t}\n\t\tmemPath = filepath.Join(dir, \"mem.db\")\n\t\tccrPath = filepath.Join(dir, \"ccr.db\")\n\t}\n\tcanonicalMemPath, err := ccr.PrepareSQLitePathCanonical(memPath)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"secure memories db: %w\", err)\n\t}\n\t// Same embedded-SQLite-behind-a-multi-process-CLI discipline as the recovery\n\t// store: a single writer connection plus busy_timeout(5000)+WAL. Several\n\t// cavemem processes (and the MCP server) share one mem.db, and the JS client\n\t// fires Promise.all(facts.map(remember)); without this, concurrent writes\n\t// returned SQLITE_BUSY and were silently dropped. See ccr.SQLiteDSN.\n\tdb, err := sql.Open(\"sqlite\", ccr.SQLiteDSN(canonicalMemPath))\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"open memories db: %w\", err)\n\t}\n\tdb.SetMaxOpenConns(1)","sourceCodeStart":84,"sourceCodeEnd":120,"githubUrl":"https://github.com/JuliusBrussee/caveman/blob/27d5a3981a347890211bb1bf2439e5c821a63bc9/mem/store.go#L84-L120","documentation":"Error \"create %s: %w\" thrown in JuliusBrussee/caveman.","triggerScenarios":"Thrown at mem/store.go:102 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Fix directory creation (path/permissions) and retry."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"27d5a3981a347890211bb1bf2439e5c821a63bc9","analyzedAt":"2026-08-15T09:26:11.751Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}