{"record":{"id":"6a5e9da66b80dfcb","repo":"JuliusBrussee/caveman","slug":"cachebench-empty-corpus","errorCode":null,"errorMessage":"cachebench: empty corpus","messagePattern":"cachebench: empty corpus","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cacheengine/cachebench/corpus.go","lineNumber":164,"sourceCode":"\t}\n\tlimited := &io.LimitedReader{R: reader, N: limits.MaxInputBytes + 1}\n\tvar rows []CorpusRow\n\tswitch format {\n\tcase CorpusFormatLMCacheJSONL:\n\t\trows, err = readLMCacheJSONL(limited, limits)\n\tcase CorpusFormatHFRows:\n\t\trows, err = readHFRows(limited, limits)\n\tdefault:\n\t\treturn AgentCorpus{}, fmt.Errorf(\"cachebench: unsupported corpus format %q\", format)\n\t}\n\tif limited.N <= 0 {\n\t\treturn AgentCorpus{}, fmt.Errorf(\"cachebench: corpus input exceeds byte limit %d\", limits.MaxInputBytes)\n\t}\n\tif err != nil {\n\t\treturn AgentCorpus{}, err\n\t}\n\tif len(rows) == 0 {\n\t\treturn AgentCorpus{}, errors.New(\"cachebench: empty corpus\")\n\t}\n\treturn AgentCorpus{Metadata: metadata, Rows: rows, SHA256: corpusDigest(rows), Bytes: corpusRetainedBytes(rows)}, nil\n}\n\nfunc normalizedCorpusLimits(limits CorpusLimits) (CorpusLimits, error) {\n\tdefaults := DefaultCorpusLimits()\n\tif limits.MaxRows <= 0 {\n\t\tlimits.MaxRows = defaults.MaxRows\n\t}\n\tif limits.MaxSessions <= 0 {\n\t\tlimits.MaxSessions = defaults.MaxSessions\n\t}\n\tif limits.MaxMessagesPerRequest <= 0 {\n\t\tlimits.MaxMessagesPerRequest = defaults.MaxMessagesPerRequest\n\t}\n\tif limits.MaxRowBytes <= 0 {\n\t\tlimits.MaxRowBytes = defaults.MaxRowBytes\n\t}","sourceCodeStart":146,"sourceCodeEnd":182,"githubUrl":"https://github.com/JuliusBrussee/caveman/blob/766dce6b1394ebb56a3090748d5a0240a5aefb36/cacheengine/cachebench/corpus.go#L146-L182","documentation":"Raised in ReadAgentCorpus after the selected reader (readLMCacheJSONL or readHFRows) returned successfully but produced zero rows. The input parsed cleanly yet contained no usable corpus rows, so downstream benchmarking would have nothing to replay.","triggerScenarios":"Thrown at cacheengine/cachebench/corpus.go:164 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Verify the input file actually contains data lines/rows and is not empty or whitespace-only","Confirm the format argument matches the file's actual layout (JSONL vs HF rows object)","Check that limits (MaxRows, MaxInputBytes) are not filtering out every row before parsing completes"],"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"}