{"record":{"id":"9fc7f046893e4901","repo":"JuliusBrussee/caveman","slug":"output-length-must-be-non-negative-and-pre-gap-mus","errorCode":null,"errorMessage":"output_length must be non-negative and pre_gap must be within 0..%d seconds","messagePattern":"output_length must be non-negative and pre_gap must be within 0\\.\\.(.+?) seconds","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cacheengine/cachebench/corpus.go","lineNumber":320,"sourceCode":"\t\treturn errors.New(\"duplicate or invalid JSON\")\n\t}\n\tdecoder := json.NewDecoder(bytes.NewReader(raw))\n\tif err := decoder.Decode(destination); err != nil {\n\t\treturn err\n\t}\n\tvar trailing any\n\tif err := decoder.Decode(&trailing); err != io.EOF {\n\t\treturn errors.New(\"trailing JSON\")\n\t}\n\treturn nil\n}\n\nfunc validateCorpusWire(wire lmcacheRowWire, index int, limits CorpusLimits) (CorpusRow, error) {\n\tif !validBoundedText(wire.SessionID, 2048, false) || !validBoundedText(wire.Model, 512, false) {\n\t\treturn CorpusRow{}, errors.New(\"session_id and model required\")\n\t}\n\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}","sourceCodeStart":302,"sourceCodeEnd":338,"githubUrl":"https://github.com/JuliusBrussee/caveman/blob/27d5a3981a347890211bb1bf2439e5c821a63bc9/cacheengine/cachebench/corpus.go#L302-L338","documentation":"Error \"output_length must be non-negative and pre_gap must be within 0..%d seconds\" thrown in JuliusBrussee/caveman.","triggerScenarios":"Thrown at cacheengine/cachebench/corpus.go:320 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Set output_length non-negative and pre_gap within the allowed range."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"27d5a3981a347890211bb1bf2439e5c821a63bc9","analyzedAt":"2026-08-15T09:26:11.751Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}