JuliusBrussee/caveman · error
ccr: unknown currentness
Error message
ccr: unknown currentness %q
What it means
prepareObject validates the Object's Currentness field before persisting to the CCR store. Empty defaults to Current, but any other value must be exactly Current, Stale, or Archived; anything else is rejected with this error. This keeps lifecycle queries over stored objects deterministic and the enum closed.
Solutions
- Set obj.Currentness to one of ccr.Current, ccr.Stale, or ccr.Archived (or leave it empty to default to Current)
- Normalize case and whitespace before assigning — the comparison is exact string equality
- Translate your application's lifecycle states into the three supported values at the boundary (e.g. map "fresh"/"new" → ccr.Current)
- Check the enum constants in engine/ccr/store.go for the exact accepted values
Example fix
// before
obj := ccr.Object{Type: ccr.ObjectRepositoryMap, Currentness: "fresh"}
// after
obj := ccr.Object{Type: ccr.ObjectRepositoryMap, Currentness: ccr.Current} Defensive patterns
Strategy: validation
Validate before calling
// Normalize and validate Currentness before PutObject
switch strings.TrimSpace(string(obj.Currentness)) {
case "", string(ccr.Current):
obj.Currentness = ccr.Current
case string(ccr.Stale):
obj.Currentness = ccr.Stale
case string(ccr.Archived):
obj.Currentness = ccr.Archived
default:
return fmt.Errorf("currentness %q must be Current, Stale, or Archived", obj.Currentness)
} Type guard
func isCurrentness(v string) bool {
switch ccr.Currentness(v) {
case ccr.Current, ccr.Stale, ccr.Archived:
return true
}
return false
} Try / catch
if _, err := store.PutObject(ctx, obj); err != nil {
if strings.Contains(err.Error(), "unknown currentness") {
return fmt.Errorf("currentness %q not in {Current,Stale,Archived}; map your lifecycle states to the CCR enum: %w", obj.Currentness, err)
}
return err
} Prevention
- Leave Currentness empty when the object is current — the store defaults it to Current
- Translate application-specific lifecycle enums to CCR's three values at the boundary
- Centralize object construction in one constructor that validates Currentness
- Re-check the enum constants after library upgrades in case the accepted set changes
When it happens
Trigger: Calling PutObject (or internal putObject) with an Object whose Currentness is a non-empty string other than Current/Stale/Archived — e.g. a custom value like "fresh", a differently-cased "CURRENT", or a value produced by another system's lifecycle enum.
Common situations: Mapping an application's own staleness states onto CCR objects without translating them to the library's three-value enum; case mismatches after reading the value from config or JSON; version drift where a formerly accepted value is no longer in the enum.
Understand the failure class
Background: Invalid enum value errors: "Unknown type", "Invalid scope", "must be one of" — when a string is not on the library's allowed list — this error's family across 23 libraries.
Related errors
- ccr: unknown object type
- assembly slot has unknown stability
- assembly slot has unknown stability
- bedrock endpoint must be runtime or mantle
- caveman agent: unknown grader
AI-assisted analysis of JuliusBrussee/caveman@3ee70a1026 (2026-09-20).
Data as JSON: /api/errors/57b773ebf816bb1a.
Report an issue: GitHub.
Appendix: source
Thrown at engine/ccr/store.go:116
ObjectFileObservation: {}, ObjectSearchResult: {}, ObjectCommandResult: {},
ObjectTestResult: {}, ObjectBuildResult: {}, ObjectDiffSnapshot: {},
ObjectTaskContract: {}, ObjectTaskDecision: {}, ObjectExecutionState: {},
ObjectDocumentationExcerpt: {}, ObjectBrowserSnapshot: {},
ObjectRepositoryMap: {}, ObjectEvidenceBundle: {},
}
func prepareObject(obj Object) (Object, error) {
if _, ok := objectTypes[obj.Type]; !ok {
return Object{}, fmt.Errorf("ccr: unknown object type %q", obj.Type)
}
if strings.TrimSpace(obj.SessionID) == "" {
return Object{}, errors.New("ccr: typed object session_id is required")
}
if obj.Currentness == "" {
obj.Currentness = Current
}
if obj.Currentness != Current && obj.Currentness != Stale && obj.Currentness != Archived {
return Object{}, fmt.Errorf("ccr: unknown currentness %q", obj.Currentness)
}
if obj.Lifecycle == "" {
obj.Lifecycle = Hot
}
if obj.Lifecycle != Hot && obj.Lifecycle != Warm && obj.Lifecycle != Cold && obj.Lifecycle != LifecycleArchived {
return Object{}, fmt.Errorf("ccr: unknown lifecycle %q", obj.Lifecycle)
}
if obj.CreatedAt.IsZero() {
obj.CreatedAt = time.Now().UTC()
} else {
obj.CreatedAt = obj.CreatedAt.UTC()
}
dataSum := sha256.Sum256(obj.Data)
computedHash := "sha256:" + hex.EncodeToString(dataSum[:])
if obj.ContentHash == "" {
obj.ContentHash = computedHash
} else if obj.ContentHash != computedHash {
return Object{}, errors.New("ccr: typed object content_hash does not match data")View on GitHub (pinned to 3ee70a1026)