{"record":{"id":"4008a9590240b9a6","repo":"JuliusBrussee/caveman","slug":"cache-replay-could-not-encode-verifier-input","errorCode":null,"errorMessage":"cache-replay: could not encode verifier input","messagePattern":"cache-replay: could not encode verifier input","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cacheengine/cmd/cache-replay/main.go","lineNumber":125,"sourceCode":"\tgo func() {\n\t\terr := json.NewEncoder(inputWriter).Encode(verificationInput)\n\t\t_ = inputWriter.CloseWithError(err)\n\t\tencodeDone <- err\n\t}()\n\tcommand.Stdin = inputReader\n\tcommand.Env = append([]string(nil), verifier.environment...)\n\tstdout := &boundedBuffer{max: verifier.maxOutputBytes}\n\tstderr := &boundedBuffer{max: 64 << 10}\n\tcommand.Stdout = stdout\n\tcommand.Stderr = stderr\n\trunErr := command.Run()\n\t_ = inputReader.Close()\n\tencodeErr := <-encodeDone\n\tif runErr != nil {\n\t\treturn cachebench.TaskVerification{}, errors.New(\"cache-replay: verifier process failed\")\n\t}\n\tif encodeErr != nil {\n\t\treturn cachebench.TaskVerification{}, errors.New(\"cache-replay: could not encode verifier input\")\n\t}\n\treturn cachebench.ParseVerificationCommandOutput(stdout.Bytes(), input.Trace.RequestID)\n}\n\ntype boundedBuffer struct {\n\tbuffer bytes.Buffer\n\tmax    int64\n}\n\nfunc (buffer *boundedBuffer) Write(value []byte) (int, error) {\n\tif int64(buffer.buffer.Len())+int64(len(value)) > buffer.max {\n\t\tremaining := buffer.max - int64(buffer.buffer.Len())\n\t\tif remaining > 0 {\n\t\t\twritten, _ := buffer.buffer.Write(value[:remaining])\n\t\t\treturn written, errors.New(\"output limit exceeded\")\n\t\t}\n\t\treturn 0, errors.New(\"output limit exceeded\")\n\t}","sourceCodeStart":107,"sourceCodeEnd":143,"githubUrl":"https://github.com/JuliusBrussee/caveman/blob/766dce6b1394ebb56a3090748d5a0240a5aefb36/cacheengine/cmd/cache-replay/main.go#L107-L143","documentation":"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.","triggerScenarios":"Thrown at cacheengine/cmd/cache-replay/main.go:125 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","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)"],"exampleFix":null,"handlingStrategy":"fallback","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"766dce6b1394ebb56a3090748d5a0240a5aefb36","analyzedAt":"2026-08-18T03:14:35.516Z","contentChangedAt":"2026-08-18T03:14:35.516Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}