JuliusBrussee/caveman · error
ccr: recovery handle not found
Error message
ccr: recovery handle not found
What it means
The CCR (crash-consistent recovery) store's sentinel ErrNotFound. The store never guesses: a handle that is not in the local store is an explicit miss rather than a silent fallback. Returned by get, getMetadata, getObject, setObjectCurrentness, setObjectLifecycle, and findTaskDecision when the SQL query finds no row.
Solutions
- Confirm the handle was created by this store instance (same DB path in config).
- Use errors.Is(err, ccr.ErrNotFound) and fall back to re-creating the recovery record.
- Check the store's database file path/config — a changed path yields an empty store.
- Restore the missing recovery database from backup if handles are long-lived.
Example fix
// before
rec, err := store.Get(handle)
if err != nil { return err }
// after
rec, err := store.Get(handle)
if errors.Is(err, ccr.ErrNotFound) {
return recomputeRecovery(input) // regenerate, don't guess
}
if err != nil { return err } Defensive patterns
Strategy: fallback
Validate before calling
if handle == "" { return errors.New("handle required before Get") } Try / catch
rec, err := store.Get(handle)
switch {
case errors.Is(err, ccr.ErrNotFound):
return regenerateRecovery(input) // explicit miss: re-create
case err != nil:
return fmt.Errorf("ccr get: %w", err)
}
return nil Prevention
- Always branch on errors.Is(err, ccr.ErrNotFound) instead of string matching.
- Keep the store DB path stable in configuration across runs.
- Back up the recovery database if handles are long-lived.
- Never construct handle strings manually; use returned values.
When it happens
Trigger: Calling Get/GetMetadata/GetObject/SetObjectCurrentness/SetObjectLifecycle/FindTaskDecision with a handle never stored in this store's database, or one that was deleted/expired; pointing the store at a different or recreated database file.
Common situations: Handle from another machine/profile; DB file deleted or moved between runs; handle typo'd or trimmed; store path changed via config so a fresh empty DB is opened.
Understand the failure class
Background: Record Not Found Errors: "not found", RecordNotFound, and "was not found" — what they mean and how to fix them — this error's family across 28 libraries.
Related errors
- ccr: recovery storage changed; restart the process and…
- ccr: storage budget exceeded
- caveman agent: baseline model unavailable
- caveman agent: unknown model
- CAVEMAN_CCR_MAX_BYTES must be a positive integer
AI-assisted analysis of JuliusBrussee/caveman@3ee70a1026 (2026-09-20).
Data as JSON: /api/errors/268fdfac933eaf98.
Report an issue: GitHub.
Appendix: source
Thrown at engine/ccr/store.go:29
// platforms (store_sqlite.go) and a pure-Go in-memory map under js/wasm
// (store_wasm.go), since modernc.org/sqlite does not build for js/wasm. Both
// expose the same type and methods, so the engine is unaware of the difference.
package ccr
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"View on GitHub (pinned to 3ee70a1026)