{"record":{"id":"151ae57cd09974c6","repo":"JuliusBrussee/caveman","slug":"migrate-sqlite-q-w","errorCode":null,"errorMessage":"migrate sqlite %q: %w","messagePattern":"migrate sqlite %q: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"engine/ccr/store_sqlite.go","lineNumber":170,"sourceCode":"\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif afterPrepare != nil {\n\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)","sourceCodeStart":152,"sourceCodeEnd":188,"githubUrl":"https://github.com/JuliusBrussee/caveman/blob/27d5a3981a347890211bb1bf2439e5c821a63bc9/engine/ccr/store_sqlite.go#L152-L188","documentation":"Error \"migrate sqlite %q: %w\" thrown in JuliusBrussee/caveman.","triggerScenarios":"Thrown at engine/ccr/store_sqlite.go:170 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Fix the sqlite 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"}