{"record":{"id":"691cd9d9eeb236ae","repo":"JuliusBrussee/caveman","slug":"configure-sqlite-storage-budget-q-w","errorCode":null,"errorMessage":"configure sqlite storage budget %q: %w","messagePattern":"configure sqlite storage budget %q: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"engine/ccr/store_sqlite.go","lineNumber":178,"sourceCode":"\t\treturn nil, fmt.Errorf(\"open sqlite %q: %w\", canonicalPath, err)\n\t}\n\t// One writer connection. With a single connection every statement serializes\n\t// in-process (no self-contention) while busy_timeout absorbs cross-process\n\t// contention; it is also mandatory for an in-memory DSN, where a second\n\t// pooled connection would be a second, empty database.\n\tdb.SetMaxOpenConns(1)\n\tdb.SetMaxIdleConns(1)\n\tif err := RetryOnBusy(func() error { _, e := db.Exec(schema); return e }); err != nil {\n\t\t_ = db.Close()\n\t\treturn nil, fmt.Errorf(\"migrate sqlite %q: %w\", canonicalPath, err)\n\t}\n\tif err := RetryOnBusy(func() error { return ensureMetadataColumn(db) }); err != nil {\n\t\t_ = db.Close()\n\t\treturn nil, fmt.Errorf(\"migrate sqlite metadata %q: %w\", canonicalPath, err)\n\t}\n\tif err := configureStorageBudget(db, maxBytes); err != nil {\n\t\t_ = db.Close()\n\t\treturn nil, fmt.Errorf(\"configure sqlite storage budget %q: %w\", canonicalPath, err)\n\t}\n\tif err := secureSQLiteFiles(canonicalPath); err != nil {\n\t\t_ = db.Close()\n\t\treturn nil, err\n\t}\n\t// CCR is one local embedded database. Serialize access through one connection:\n\t// this prevents SQLITE_BUSY under background capture and keeps :memory:\n\t// stores on the same schema-bearing connection.\n\tdb.SetMaxOpenConns(1)\n\tdb.SetMaxIdleConns(1)\n\treturn &Store{db: db, maxBytes: maxBytes}, nil\n}\n\n// PrepareSQLitePath creates or tightens a persistent SQLite file before the\n// driver sees it. Recovery databases can contain prompts, credentials, and tool\n// results, so neither a permissive umask nor a caller-supplied symlink may widen\n// access. Existing WAL/SHM files receive the same checks.\nfunc PrepareSQLitePath(path string) error {","sourceCodeStart":160,"sourceCodeEnd":196,"githubUrl":"https://github.com/JuliusBrussee/caveman/blob/27d5a3981a347890211bb1bf2439e5c821a63bc9/engine/ccr/store_sqlite.go#L160-L196","documentation":"Error \"configure sqlite storage budget %q: %w\" thrown in JuliusBrussee/caveman.","triggerScenarios":"Thrown at engine/ccr/store_sqlite.go:178 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Fix the sqlite storage budget configuration error."],"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-15T17:31:12.345Z"}