JuliusBrussee/caveman · error
cache-replay: could not encode verifier input
Error message
cache-replay: could not encode verifier input
What it means
JSON-encoding the verification input for the verifier's stdin failed (or the pipe errored) after the process ran. The structured no-shell protocol streams the input via an io.Pipe; an encode failure aborts the verification as malformed rather than sending partial input.
Solutions
- Check for unwritable-closed pipe causes, e.g. the verifier exiting before reading stdin
- Ensure the verification input contains only JSON-encodable values (no channels/funcs/cycles)
Defensive patterns
Strategy: fallback
When it happens
Trigger: Thrown at cacheengine/cmd/cache-replay/main.go:125 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/4008a9590240b9a6.
Report an issue: GitHub.
Appendix: source
Thrown at cacheengine/cmd/cache-replay/main.go:125
go func() {
err := json.NewEncoder(inputWriter).Encode(verificationInput)
_ = inputWriter.CloseWithError(err)
encodeDone <- err
}()
command.Stdin = inputReader
command.Env = append([]string(nil), verifier.environment...)
stdout := &boundedBuffer{max: verifier.maxOutputBytes}
stderr := &boundedBuffer{max: 64 << 10}
command.Stdout = stdout
command.Stderr = stderr
runErr := command.Run()
_ = inputReader.Close()
encodeErr := <-encodeDone
if runErr != nil {
return cachebench.TaskVerification{}, errors.New("cache-replay: verifier process failed")
}
if encodeErr != nil {
return cachebench.TaskVerification{}, errors.New("cache-replay: could not encode verifier input")
}
return cachebench.ParseVerificationCommandOutput(stdout.Bytes(), input.Trace.RequestID)
}
type boundedBuffer struct {
buffer bytes.Buffer
max int64
}
func (buffer *boundedBuffer) Write(value []byte) (int, error) {
if int64(buffer.buffer.Len())+int64(len(value)) > buffer.max {
remaining := buffer.max - int64(buffer.buffer.Len())
if remaining > 0 {
written, _ := buffer.buffer.Write(value[:remaining])
return written, errors.New("output limit exceeded")
}
return 0, errors.New("output limit exceeded")
}View on GitHub (pinned to 766dce6b13)