JuliusBrussee/caveman · error
cachebench: verifier returned invalid JSON
Error message
cachebench: verifier returned invalid JSON
What it means
Raised in ParseVerificationCommandOutput: the raw bytes passed the unique-object pre-check but strict decoding (with DisallowUnknownFields) into VerificationCommandOutput failed. The verifier's JSON is syntactically an object yet does not bind to the expected schema — wrong field types, unknown fields, or truncated output.
Solutions
- Match the expected schema exactly: schema, request_id, passed, verifier, evidence
- Remove unknown/extra fields from the verifier output (DisallowUnknownFields is set)
- Correct field types, e.g. passed must be a JSON boolean, not a string
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at cacheengine/cachebench/replay.go:58 when the library encounters an invalid state.
Common situations: See trigger scenarios.
Understand the failure class
- Parsing and encoding errors: unexpected token, malformed input — why parsers reject input and how to find the real culprit.
AI-assisted analysis of JuliusBrussee/caveman@766dce6b13 (2026-08-18).
Data as JSON: /api/errors/489df0c181e0e538.
Report an issue: GitHub.
Appendix: source
Thrown at cacheengine/cachebench/replay.go:58
type VerificationCommandOutput struct {
Schema string `json:"schema"`
RequestID string `json:"request_id"`
Passed bool `json:"passed"`
Verifier string `json:"verifier"`
Evidence json.RawMessage `json:"evidence"`
}
// ParseVerificationCommandOutput validates and binds external grader evidence.
func ParseVerificationCommandOutput(raw []byte, requestID string) (TaskVerification, error) {
raw = bytes.TrimSpace(raw)
if !validUniqueJSONObject(raw) {
return TaskVerification{}, errors.New("cachebench: verifier returned duplicate or invalid JSON")
}
decoder := json.NewDecoder(bytes.NewReader(raw))
decoder.DisallowUnknownFields()
var result VerificationCommandOutput
if decoder.Decode(&result) != nil {
return TaskVerification{}, errors.New("cachebench: verifier returned invalid JSON")
}
var trailing any
if decoder.Decode(&trailing) != io.EOF || result.Schema != VerificationSchema || result.RequestID != requestID || !validBoundedText(result.Verifier, 256, false) || len(result.Evidence) == 0 || !json.Valid(result.Evidence) || bytes.Equal(bytes.TrimSpace(result.Evidence), []byte("null")) {
return TaskVerification{}, errors.New("cachebench: verifier returned incomplete or mismatched evidence")
}
return TaskVerification{Passed: result.Passed, Verifier: result.Verifier, Evidence: append([]byte(nil), raw...)}, nil
}
// ReplayLimits bounds paid population, schedule, and concurrency.
type ReplayLimits struct {
MaxRequests int
MaxDeclaredBilledTokens int64
MaxGap time.Duration
MaxScheduleDrift time.Duration
MaxConcurrency int
RequireGroundedTiming bool
RequireProviderTokens bool
}View on GitHub (pinned to 766dce6b13)