{"record":{"id":"968adf54f20df84f","repo":"JuliusBrussee/caveman","slug":"message-d-w","errorCode":null,"errorMessage":"message %d: %w","messagePattern":"message (.+?): %w","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cacheengine/cachebench/corpus.go","lineNumber":337,"sourceCode":"\tif wire.OutputLength < 0 || math.IsNaN(wire.PreGap) || math.IsInf(wire.PreGap, 0) || wire.PreGap < 0 || wire.PreGap > maxCorpusGapSeconds {\n\t\treturn CorpusRow{}, fmt.Errorf(\"output_length must be non-negative and pre_gap must be within 0..%d seconds\", maxCorpusGapSeconds)\n\t}\n\tif len(wire.Input) == 0 || !json.Valid(wire.Input) {\n\t\treturn CorpusRow{}, errors.New(\"input must be valid non-empty message array\")\n\t}\n\tif len(wire.SessionID)+len(wire.Model)+len(wire.Input) > limits.MaxRowBytes {\n\t\treturn CorpusRow{}, fmt.Errorf(\"row exceeds byte limit %d\", limits.MaxRowBytes)\n\t}\n\tvar messages []CorpusMessage\n\tif err := json.Unmarshal(wire.Input, &messages); err != nil {\n\t\treturn CorpusRow{}, fmt.Errorf(\"decode input: %w\", err)\n\t}\n\tif len(messages) == 0 || len(messages) > limits.MaxMessagesPerRequest {\n\t\treturn CorpusRow{}, fmt.Errorf(\"message count %d outside 1..%d\", len(messages), limits.MaxMessagesPerRequest)\n\t}\n\tfor messageIndex, message := range messages {\n\t\tif err := validateCorpusMessage(message, limits); err != nil {\n\t\t\treturn CorpusRow{}, fmt.Errorf(\"message %d: %w\", messageIndex, err)\n\t\t}\n\t}\n\treturn CorpusRow{\n\t\tRowIndex: index, SessionID: wire.SessionID, Model: wire.Model, Input: messages,\n\t\tOutputLength: wire.OutputLength, PreGap: wire.PreGap,\n\t}, nil\n}\n\nfunc validateCorpusMessage(message CorpusMessage, limits CorpusLimits) error {\n\tswitch message.Role {\n\tcase \"system\", \"developer\", \"user\", \"assistant\", \"tool\":\n\tdefault:\n\t\treturn fmt.Errorf(\"unsupported role %q\", message.Role)\n\t}\n\tif !validBoundedText(message.ToolCallID, 2048, true) || !validBoundedText(message.Name, 512, true) {\n\t\treturn errors.New(\"invalid message identity\")\n\t}\n\tif len(message.Content) == 0 && len(message.ToolCalls) == 0 {","sourceCodeStart":319,"sourceCodeEnd":355,"githubUrl":"https://github.com/JuliusBrussee/caveman/blob/766dce6b1394ebb56a3090748d5a0240a5aefb36/cacheengine/cachebench/corpus.go#L319-L355","documentation":"Wrap in validateCorpusWire: per-message validation (validateCorpusMessage) failed for the message at the interpolated index. The wrapped error names the specific defect; that message in the corpus row is at fault.","triggerScenarios":"Thrown at cacheengine/cachebench/corpus.go:337 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Inspect the cited message for unsupported role, oversized content, or malformed tool calls","Fix or drop the message in the corpus source"],"exampleFix":null,"handlingStrategy":"validation","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"}