JuliusBrussee/caveman · warning

ccr: storage budget exceeded

Error message

ccr: storage budget exceeded

What it means

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.

Solutions

  1. Increase the store's maxBytes budget in configuration to fit the workload.
  2. Handle ErrBudgetExceeded by passing the original (uncompressed) input through, per the documented contract.
  3. Prune/expire old recoveries to free budget before the next put.
  4. Compress payloads before storage so newBytes fits the remaining budget.

Example fix

// before
handle, err := store.Put(data)
if err != nil { return err }

// after
handle, err := store.Put(data)
if errors.Is(err, ccr.ErrBudgetExceeded) {
    return passThroughOriginal(input) // documented fallback
}
if err != nil { return err }
Defensive patterns

Strategy: fallback

Validate before calling

if len(payload) > store.MaxBytes() { return passThroughOriginal(payload) }

Try / catch

handle, err := store.Put(data)
if errors.Is(err, ccr.ErrBudgetExceeded) {
    return passThroughOriginal(input) // documented passthrough contract
}
if err != nil { return err }

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Understand the failure class

Background: payload too large / request exceeds maximum size: why libraries cap bytes and how to fix oversize payloads — this error's family across 50 libraries.

Related errors


AI-assisted analysis of JuliusBrussee/caveman@3ee70a1026 (2026-09-20). Data as JSON: /api/errors/065c29b9781dc600. Report an issue: GitHub.

Appendix: source

Thrown at engine/ccr/store.go:34

import (
	"bytes"
	"crypto/sha256"
	"encoding/hex"
	"errors"
	"fmt"
	"slices"
	"strings"
	"time"
)

// ErrNotFound is returned by Get when a handle is unknown. The store never
// guesses a recovery — an unknown handle is an explicit miss.
var ErrNotFound = errors.New("ccr: recovery handle not found")

// ErrBudgetExceeded means a new recovery was refused before publishing lossy
// bytes because the local store's configured payload budget would be exceeded.
// Existing handles remain intact and retrievable; callers must pass through.
var ErrBudgetExceeded = errors.New("ccr: storage budget exceeded")

// ErrStorageChanged means the recovery database no longer matches the open
// connection. Callers must preserve the original input and report the error.
var ErrStorageChanged = errors.New("ccr: recovery storage changed; restart the process and restore missing recovery files")

// ObjectType is a closed typed-working-memory enum. Unknown values fail closed:
// adapters may preserve unknown native payloads outside CCR, but may not invent
// retrieval semantics for them.
type ObjectType string

const (
	ObjectFileObservation      ObjectType = "FileObservation"
	ObjectSearchResult         ObjectType = "SearchResult"
	ObjectCommandResult        ObjectType = "CommandResult"
	ObjectTestResult           ObjectType = "TestResult"
	ObjectBuildResult          ObjectType = "BuildResult"
	ObjectDiffSnapshot         ObjectType = "DiffSnapshot"
	ObjectTaskContract         ObjectType = "TaskContract"

View on GitHub (pinned to 3ee70a1026)