JuliusBrussee/caveman · error
marshal session-value artifact: %w
Error message
marshal session-value artifact: %w
What it means
ComputeSessionValueArtifactHash failed to JSON-marshal the session-value policy artifact while computing its canonical hash (the ArtifactHash field is zeroed first so the hash is self-consistent). Marshal failures here indicate non-serializable field types (NaN/Inf floats are the usual cause), not bad input data from callers.
Source
Thrown at proxy/routing/session_value.go:148
}
type SessionValuePrediction struct {
ActionID string
RewardProbability float64
QualityLCB float64
ExpectedResidualCostUSD float64
ExpectedCostUSD float64
CostUCBUSD float64
ExpectedCorrectiveTurns float64
EscalationProbability float64
QualityUncertainty float64
}
func ComputeSessionValueArtifactHash(artifact SessionValuePolicyArtifact) (string, error) {
artifact.ArtifactHash = ""
raw, err := json.Marshal(artifact)
if err != nil {
return "", fmt.Errorf("marshal session-value artifact: %w", err)
}
sum := sha256.Sum256(raw)
return "sha256:" + hex.EncodeToString(sum[:]), nil
}
func SealSessionValueArtifact(artifact SessionValuePolicyArtifact) (SessionValuePolicyArtifact, error) {
hash, err := ComputeSessionValueArtifactHash(artifact)
if err != nil {
return SessionValuePolicyArtifact{}, err
}
artifact.ArtifactHash = hash
return artifact, nil
}
func ValidateSessionValueArtifact(artifact SessionValuePolicyArtifact, organizationID, projectID, candidatePoolHash string, now time.Time) error {
if artifact.Schema != SessionValueArtifactSchema || artifact.StateSchemaVersion != SessionValueStateSchema {
return errors.New("session-value artifact schema mismatch")
}View on GitHub (pinned to 766dce6b13)
Solutions
- Ensure all numeric fields of the artifact are finite (no NaN or +Inf) before sealing
- Fix the artifact-producing pipeline if it can emit non-serializable values
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at proxy/routing/session_value.go:148 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of JuliusBrussee/caveman@766dce6b13 (2026-08-18).
Data as JSON: /api/errors/b438fec331278fd5.
Report an issue: GitHub.