{"record":{"id":"548e4c635bbf2fc8","repo":"JuliusBrussee/caveman","slug":"migrate-sqlite-metadata-q-w","errorCode":null,"errorMessage":"migrate sqlite metadata %q: %w","messagePattern":"migrate sqlite metadata %q: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"engine/ccr/store_sqlite.go","lineNumber":174,"sourceCode":"\t\tafterPrepare()\n\t}\n\tdb, err := sql.Open(\"sqlite\", SQLiteDSN(canonicalPath))\n\tif err != nil {\n\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","sourceCodeStart":156,"sourceCodeEnd":192,"githubUrl":"https://github.com/JuliusBrussee/caveman/blob/27d5a3981a347890211bb1bf2439e5c821a63bc9/engine/ccr/store_sqlite.go#L156-L192","documentation":"Error \"migrate sqlite metadata %q: %w\" thrown in JuliusBrussee/caveman.","triggerScenarios":"Thrown at engine/ccr/store_sqlite.go:174 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Fix the sqlite metadata migration error 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"}