{"record":{"id":"065c29b9781dc600","repo":"JuliusBrussee/caveman","slug":"ccr-storage-budget-exceeded","errorCode":null,"errorMessage":"ccr: storage budget exceeded","messagePattern":"ccr: storage budget exceeded","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"engine/ccr/store.go","lineNumber":34,"sourceCode":"import (\n\t\"bytes\"\n\t\"crypto/sha256\"\n\t\"encoding/hex\"\n\t\"errors\"\n\t\"fmt\"\n\t\"slices\"\n\t\"strings\"\n\t\"time\"\n)\n\n// ErrNotFound is returned by Get when a handle is unknown. The store never\n// guesses a recovery — an unknown handle is an explicit miss.\nvar ErrNotFound = errors.New(\"ccr: recovery handle not found\")\n\n// ErrBudgetExceeded means a new recovery was refused before publishing lossy\n// bytes because the local store's configured payload budget would be exceeded.\n// Existing handles remain intact and retrievable; callers must pass through.\nvar ErrBudgetExceeded = errors.New(\"ccr: storage budget exceeded\")\n\n// ErrStorageChanged means the recovery database no longer matches the open\n// connection. Callers must preserve the original input and report the error.\nvar ErrStorageChanged = errors.New(\"ccr: recovery storage changed; restart the process and restore missing recovery files\")\n\n// ObjectType is a closed typed-working-memory enum. Unknown values fail closed:\n// adapters may preserve unknown native payloads outside CCR, but may not invent\n// retrieval semantics for them.\ntype ObjectType string\n\nconst (\n\tObjectFileObservation      ObjectType = \"FileObservation\"\n\tObjectSearchResult         ObjectType = \"SearchResult\"\n\tObjectCommandResult        ObjectType = \"CommandResult\"\n\tObjectTestResult           ObjectType = \"TestResult\"\n\tObjectBuildResult          ObjectType = \"BuildResult\"\n\tObjectDiffSnapshot         ObjectType = \"DiffSnapshot\"\n\tObjectTaskContract         ObjectType = \"TaskContract\"","sourceCodeStart":16,"sourceCodeEnd":52,"githubUrl":"https://github.com/JuliusBrussee/caveman/blob/3ee70a102609e550bd2e68004bf5990a9341c851/engine/ccr/store.go#L16-L52","documentation":"CCR's sentinel ErrBudgetExceeded: a new recovery write was refused because publishing it would exceed the store's configured max payload budget. Existing handles remain intact and retrievable; the intended contract is that callers pass the original input through unchanged instead of storing lossy compressed bytes.","triggerScenarios":"Put/PutObject/putObject via checkRecoveryBudget when used+newBytes exceeds s.maxBytes; emitting a compress result whose payload is larger than remaining budget; putting objects into a store already near its maxBytes limit.","commonSituations":"maxBytes configured too small for the workload's payload sizes; long-running session accumulating many recoveries; large single payloads (big files/responses) that alone exceed the budget.","solutions":["Increase the store's maxBytes budget in configuration to fit the workload.","Handle ErrBudgetExceeded by passing the original (uncompressed) input through, per the documented contract.","Prune/expire old recoveries to free budget before the next put.","Compress payloads before storage so newBytes fits the remaining budget."],"exampleFix":"// before\nhandle, err := store.Put(data)\nif err != nil { return err }\n\n// after\nhandle, err := store.Put(data)\nif errors.Is(err, ccr.ErrBudgetExceeded) {\n    return passThroughOriginal(input) // documented fallback\n}\nif err != nil { return err }","handlingStrategy":"fallback","validationCode":"if len(payload) > store.MaxBytes() { return passThroughOriginal(payload) }","typeGuard":null,"tryCatchPattern":"handle, err := store.Put(data)\nif errors.Is(err, ccr.ErrBudgetExceeded) {\n    return passThroughOriginal(input) // documented passthrough contract\n}\nif err != nil { return err }","preventionTips":["Size maxBytes above the worst-case payload plus headroom.","Compress large payloads before Put to fit the budget.","Expire/prune old recoveries on a schedule.","Monitor budget usage and alert before exhaustion."],"tags":["ccr","quota","storage-budget","sentinel-error"],"backgroundTag":"payload-too-large","analyzedSha":"3ee70a102609e550bd2e68004bf5990a9341c851","analyzedAt":"2026-09-20T15:53:39.229Z","contentChangedAt":"2026-09-20T15:53:39.229Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}