{"record":{"id":"e6a86ba02a9f92c5","repo":"JuliusBrussee/caveman","slug":"budget-d-is-below-sqlite-minimum-d","errorCode":null,"errorMessage":"budget %d is below SQLite minimum %d","messagePattern":"budget (.+?) is below SQLite minimum (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"engine/ccr/store_sqlite.go","lineNumber":300,"sourceCode":"\t\treturn err\n\t}\n\tif !os.SameFile(info, opened) {\n\t\treturn fmt.Errorf(\"file changed while opening\")\n\t}\n\treturn file.Chmod(0o600)\n}\n\nfunc configureStorageBudget(db *sql.DB, maxBytes int64) error {\n\tvar pageSize int64\n\tif err := db.QueryRow(`PRAGMA page_size`).Scan(&pageSize); err != nil {\n\t\treturn fmt.Errorf(\"read page size: %w\", err)\n\t}\n\tif pageSize <= 0 {\n\t\treturn errors.New(\"invalid sqlite page size\")\n\t}\n\tmaxPages := maxBytes / pageSize\n\tif maxPages < 16 {\n\t\treturn fmt.Errorf(\"budget %d is below SQLite minimum %d\", maxBytes, 16*pageSize)\n\t}\n\tvar applied int64\n\tif err := db.QueryRow(fmt.Sprintf(`PRAGMA max_page_count=%d`, maxPages)).Scan(&applied); err != nil {\n\t\treturn err\n\t}\n\tif applied < maxPages {\n\t\tmaxPages = applied\n\t}\n\tautoCheckpoint := maxPages / 16\n\tif autoCheckpoint < 1 {\n\t\tautoCheckpoint = 1\n\t}\n\tif _, err := db.Exec(fmt.Sprintf(`PRAGMA wal_autocheckpoint=%d`, autoCheckpoint)); err != nil {\n\t\treturn err\n\t}\n\t_, err := db.Exec(fmt.Sprintf(`PRAGMA journal_size_limit=%d`, maxBytes/8))\n\treturn err\n}","sourceCodeStart":282,"sourceCodeEnd":318,"githubUrl":"https://github.com/JuliusBrussee/caveman/blob/766dce6b1394ebb56a3090748d5a0240a5aefb36/engine/ccr/store_sqlite.go#L282-L318","documentation":"Raised by configureStorageBudget: the byte budget divided by the database page size yields fewer than 16 pages, below SQLite's minimum database size. The configured budget is too small to hold any usable database, so opening fails rather than silently clamping.","triggerScenarios":"Thrown at engine/ccr/store_sqlite.go:300 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Raise the budget to at least 16 * page_size bytes (the message states the minimum)","Use the default budget instead of a tiny custom one","Set CAVEMAN_CCR_MAX_BYTES to a value appropriate for real recovery payloads"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"766dce6b1394ebb56a3090748d5a0240a5aefb36","analyzedAt":"2026-08-18T03:14:35.516Z","contentChangedAt":"2026-08-18T03:14:35.516Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}