{"record":{"id":"2ab9ebf5c5398684","repo":"JuliusBrussee/caveman","slug":"retained-corpus-byte-limit-d-exceeded","errorCode":null,"errorMessage":"retained corpus byte limit %d exceeded","messagePattern":"retained corpus byte limit (.+?) exceeded","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cacheengine/cachebench/corpus.go","lineNumber":400,"sourceCode":"\tif message.Role == \"tool\" && message.ToolCallID == \"\" {\n\t\treturn errors.New(\"tool message requires tool_call_id\")\n\t}\n\treturn nil\n}\n\nfunc appendCorpusRow(rows *[]CorpusRow, sessions map[string]bool, retainedBytes *int64, row CorpusRow, limits CorpusLimits) error {\n\tif len(*rows) >= limits.MaxRows {\n\t\treturn fmt.Errorf(\"row limit %d exceeded\", limits.MaxRows)\n\t}\n\tif !sessions[row.SessionID] {\n\t\tif len(sessions) >= limits.MaxSessions {\n\t\t\treturn fmt.Errorf(\"session limit %d exceeded\", limits.MaxSessions)\n\t\t}\n\t\tsessions[row.SessionID] = true\n\t}\n\trowBytes := corpusRowRetainedBytes(row)\n\tif rowBytes > limits.MaxRetainedBytes-*retainedBytes {\n\t\treturn fmt.Errorf(\"retained corpus byte limit %d exceeded\", limits.MaxRetainedBytes)\n\t}\n\t*retainedBytes += rowBytes\n\t*rows = append(*rows, row)\n\treturn nil\n}\n\nfunc corpusRetainedBytes(rows []CorpusRow) int64 {\n\tvar total int64\n\tfor _, row := range rows {\n\t\ttotal += corpusRowRetainedBytes(row)\n\t}\n\treturn total\n}\n\nfunc corpusRowRetainedBytes(row CorpusRow) int64 {\n\ttotal := int64(len(row.SessionID) + len(row.Model))\n\tfor _, message := range row.Input {\n\t\ttotal += int64(len(message.Role) + len(message.Content) + len(message.ToolCallID) + len(message.Name))","sourceCodeStart":382,"sourceCodeEnd":418,"githubUrl":"https://github.com/JuliusBrussee/caveman/blob/766dce6b1394ebb56a3090748d5a0240a5aefb36/cacheengine/cachebench/corpus.go#L382-L418","documentation":"Adding this row would push the total retained corpus bytes (sum of per-row retained sizes tracked incrementally) past limits.MaxTotalBytes. This is the aggregate memory bound, distinct from the per-row limit.","triggerScenarios":"Thrown at cacheengine/cachebench/corpus.go:400 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Raise the aggregate byte limit for larger benchmarks","Trim message content or drop low-value rows before reading"],"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"}