{"record":{"id":"954061027ffa4555","repo":"JuliusBrussee/caveman","slug":"cachebench-corpus-limits-exceed-hard-resource-cei","errorCode":null,"errorMessage":"cachebench: corpus limits exceed hard resource ceilings","messagePattern":"cachebench: corpus limits exceed hard resource ceilings","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cacheengine/cachebench/corpus.go","lineNumber":193,"sourceCode":"\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}\n\tif limits.MaxMessageBytes <= 0 {\n\t\tlimits.MaxMessageBytes = defaults.MaxMessageBytes\n\t}\n\tif limits.MaxRetainedBytes <= 0 {\n\t\tlimits.MaxRetainedBytes = defaults.MaxRetainedBytes\n\t}\n\tif limits.MaxInputBytes <= 0 {\n\t\tlimits.MaxInputBytes = limits.MaxRetainedBytes\n\t}\n\tif limits.MaxRows > 1_000_000 || limits.MaxSessions > 1_000_000 || limits.MaxMessagesPerRequest > 100_000 || limits.MaxRowBytes > 256<<20 || limits.MaxMessageBytes > 128<<20 || limits.MaxInputBytes > 16<<30 || limits.MaxRetainedBytes > 16<<30 {\n\t\treturn CorpusLimits{}, errors.New(\"cachebench: corpus limits exceed hard resource ceilings\")\n\t}\n\treturn limits, nil\n}\n\nfunc readLMCacheJSONL(reader io.Reader, limits CorpusLimits) ([]CorpusRow, error) {\n\tscanner := bufio.NewScanner(reader)\n\tscanner.Buffer(make([]byte, 64*1024), limits.MaxRowBytes)\n\trows := make([]CorpusRow, 0)\n\tsessions := map[string]bool{}\n\tvar retainedBytes int64\n\tfor line := 1; scanner.Scan(); line++ {\n\t\traw := bytes.TrimSpace(scanner.Bytes())\n\t\tif len(raw) == 0 {\n\t\t\tcontinue\n\t\t}\n\t\tvar wire lmcacheRowWire\n\t\tif err := decodeOneJSON(raw, &wire); err != nil {\n\t\t\treturn nil, fmt.Errorf(\"cachebench: corpus line %d: %w\", line, err)","sourceCodeStart":175,"sourceCodeEnd":211,"githubUrl":"https://github.com/JuliusBrussee/caveman/blob/766dce6b1394ebb56a3090748d5a0240a5aefb36/cacheengine/cachebench/corpus.go#L175-L211","documentation":"Raised in normalizedCorpusLimits when caller-supplied limits exceed hardcoded resource ceilings (MaxRows or MaxSessions over 1,000,000, MaxMessagesPerRequest over its cap, etc.). The library refuses resource-exhaustion configurations rather than attempting the read.","triggerScenarios":"Thrown at cacheengine/cachebench/corpus.go:193 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Reduce CorpusLimits values below the hard ceilings (e.g. MaxRows and MaxSessions <= 1,000,000)","Zero-valued limits get safe defaults, so simply omit fields you do not need to raise","Precompute limits from corpus size instead of passing maximal placeholders"],"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"}