{"record":{"id":"a18843921142ca65","repo":"JuliusBrussee/caveman","slug":"cachebench-replay-response-limit-must-be-between","errorCode":null,"errorMessage":"cachebench: replay response limit must be between 1 byte and 256 MiB","messagePattern":"cachebench: replay response limit must be between 1 byte and 256 MiB","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cacheengine/cachebench/replay_http.go","lineNumber":64,"sourceCode":"\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\",\n\t\t\"gemini\":    \"https://generativelanguage.googleapis.com\",\n\t}\n\tfor provider, value := range config.BaseURLs {\n\t\tprovider = strings.ToLower(strings.TrimSpace(provider))\n\t\tif provider != \"openai\" && provider != \"anthropic\" && provider != \"gemini\" && provider != \"bedrock\" {\n\t\t\treturn nil, fmt.Errorf(\"cachebench: unsupported replay base URL provider %q\", provider)\n\t\t}","sourceCodeStart":46,"sourceCodeEnd":82,"githubUrl":"https://github.com/JuliusBrussee/caveman/blob/766dce6b1394ebb56a3090748d5a0240a5aefb36/cacheengine/cachebench/replay_http.go#L46-L82","documentation":"NewHTTPReplayTransport validated the response-size ceiling and found it outside the 1-byte to 256-MiB window (0 defaults to defaultReplayResponseLimit first). Responses beyond the ceiling would be unbounded reads, so the misconfigured transport is refused at construction.","triggerScenarios":"Thrown at cacheengine/cachebench/replay_http.go:64 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Set MaxResponseBytes within 1 byte to 256 MiB, or leave 0 for the default","Correct the transport configuration before constructing the transport"],"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"}