{"record":{"id":"c041ec193dca7084","repo":"JuliusBrussee/caveman","slug":"cachebench-replay-request-limit-must-be-between-1","errorCode":null,"errorMessage":"cachebench: replay request limit must be between 1 byte and 256 MiB","messagePattern":"cachebench: replay request limit must be between 1 byte and 256 MiB","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cacheengine/cachebench/replay_http.go","lineNumber":57,"sourceCode":"}\n\n// HTTPReplayTransport sends official non-streaming provider requests.\ntype HTTPReplayTransport struct {\n\tclient           *http.Client\n\tcredentials      HTTPReplayCredentials\n\tbaseURLs         map[string]*url.URL\n\tmaxRequestBytes  int64\n\tmaxResponseBytes int64\n}\n\n// NewHTTPReplayTransport validates endpoints, limits, TLS, and redirect policy.\nfunc NewHTTPReplayTransport(config HTTPReplayConfig) (*HTTPReplayTransport, error) {\n\trequestLimit := config.MaxRequestBytes\n\tif requestLimit == 0 {\n\t\trequestLimit = 64 << 20\n\t}\n\tif requestLimit < 1 || requestLimit > 256<<20 {\n\t\treturn nil, errors.New(\"cachebench: replay request limit must be between 1 byte and 256 MiB\")\n\t}\n\tlimit := config.MaxResponseBytes\n\tif limit == 0 {\n\t\tlimit = defaultReplayResponseLimit\n\t}\n\tif limit < 1 || limit > 256<<20 {\n\t\treturn nil, errors.New(\"cachebench: replay response limit must be between 1 byte and 256 MiB\")\n\t}\n\trequestTimeout := config.RequestTimeout\n\tif requestTimeout == 0 {\n\t\trequestTimeout = 2 * time.Minute\n\t}\n\tif requestTimeout < time.Second || requestTimeout > time.Hour {\n\t\treturn nil, errors.New(\"cachebench: replay request timeout must be between 1 second and 1 hour\")\n\t}\n\tbases := map[string]string{\n\t\t\"openai\":    \"https://api.openai.com\",\n\t\t\"anthropic\": \"https://api.anthropic.com\",","sourceCodeStart":39,"sourceCodeEnd":75,"githubUrl":"https://github.com/JuliusBrussee/caveman/blob/766dce6b1394ebb56a3090748d5a0240a5aefb36/cacheengine/cachebench/replay_http.go#L39-L75","documentation":"NewHTTPReplayTransport validated the configured request-size ceiling and found it below 1 byte or above 256 MiB (0 defaults to 64 MiB first). The bound keeps replay memory predictable; out-of-range limits are rejected at construction before any transport is built.","triggerScenarios":"Thrown at cacheengine/cachebench/replay_http.go:57 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Set MaxRequestBytes within 1 byte to 256 MiB, or leave 0 for the default","Check for negative/garbage values in the cachebench config"],"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"}