JuliusBrussee/caveman · error
cachebench: verifier returned duplicate or invalid JSON
Error message
cachebench: verifier returned duplicate or invalid JSON
What it means
Raised in ParseVerificationCommandOutput: the external verifier command's stdout bytes failed validUniqueJSONObject. The grader's output must be a single JSON object; duplicate keys or any non-object/invalid JSON in the verifier payload is rejected before decoding.
Solutions
- Fix the verifier script to emit exactly one JSON object with unique keys
- Capture the verifier's raw stdout to inspect what it actually printed (stderr, log lines, multiple documents)
- Ensure no wrapper or shell prepends text to the JSON payload
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at cacheengine/cachebench/replay.go:52 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/8bd9ca598c52793a.
Report an issue: GitHub.
Appendix: source
Thrown at cacheengine/cachebench/replay.go:52
OriginalRequest json.RawMessage `json:"original_request"`
OptimizedRequest json.RawMessage `json:"optimized_request"`
ProviderResponse json.RawMessage `json:"provider_response"`
}
// VerificationCommandOutput is strict external task-grader response.
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 int64View on GitHub (pinned to 766dce6b13)