{"record":{"id":"3c1087b6a3b33f3b","repo":"JuliusBrussee/caveman","slug":"caveman-ccr-max-bytes-must-be-a-positive-integer","errorCode":null,"errorMessage":"CAVEMAN_CCR_MAX_BYTES must be a positive integer","messagePattern":"CAVEMAN_CCR_MAX_BYTES must be a positive integer","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"engine/ccr/store_sqlite.go","lineNumber":132,"sourceCode":"\treturn err\n}\n\nfunc isBusy(err error) bool {\n\tif err == nil {\n\t\treturn false\n\t}\n\ts := err.Error()\n\treturn strings.Contains(s, \"database is locked\") || strings.Contains(s, \"SQLITE_BUSY\")\n}\n\n// Open opens (creating if needed) the SQLite database at path and migrates the\n// schema. Use \":memory:\" for an ephemeral store (tests, the eval harness).\nfunc Open(path string) (*Store, error) {\n\tmaxBytes := DefaultMaxStorageBytes\n\tif raw := strings.TrimSpace(os.Getenv(\"CAVEMAN_CCR_MAX_BYTES\")); raw != \"\" {\n\t\tparsed, err := strconv.ParseInt(raw, 10, 64)\n\t\tif err != nil || parsed <= 0 {\n\t\t\treturn nil, fmt.Errorf(\"CAVEMAN_CCR_MAX_BYTES must be a positive integer\")\n\t\t}\n\t\tmaxBytes = parsed\n\t}\n\treturn OpenWithBudget(path, maxBytes)\n}\n\n// OpenWithBudget opens a persistent store with an explicit retained-payload\n// budget. New writes fail with ErrBudgetExceeded; existing recovery rows are\n// never evicted because an emitted transformed request may still reference any\n// handle.\nfunc OpenWithBudget(path string, maxBytes int64) (*Store, error) {\n\treturn openWithBudget(path, maxBytes, nil)\n}\n\nfunc openWithBudget(path string, maxBytes int64, afterPrepare func()) (*Store, error) {\n\tif maxBytes <= 0 {\n\t\treturn nil, fmt.Errorf(\"ccr max storage bytes must be positive\")\n\t}","sourceCodeStart":114,"sourceCodeEnd":150,"githubUrl":"https://github.com/JuliusBrussee/caveman/blob/27d5a3981a347890211bb1bf2439e5c821a63bc9/engine/ccr/store_sqlite.go#L114-L150","documentation":"Error \"CAVEMAN_CCR_MAX_BYTES must be a positive integer\" thrown in JuliusBrussee/caveman.","triggerScenarios":"Thrown at engine/ccr/store_sqlite.go:132 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Set CAVEMAN_CCR_MAX_BYTES to a positive integer."],"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"}