{"record":{"id":"9633a59d637af52d","repo":"JuliusBrussee/caveman","slug":"cachebench-invalid-replay-model","errorCode":null,"errorMessage":"cachebench: invalid replay model","messagePattern":"cachebench: invalid replay model","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cacheengine/cachebench/replay_http.go","lineNumber":167,"sourceCode":"\t\treturn ReplayResponse{}, errors.New(\"cachebench: provider request failed\")\n\t}\n\tdefer response.Body.Close()\n\tbody, err := io.ReadAll(io.LimitReader(response.Body, transport.maxResponseBytes+1))\n\tif err != nil {\n\t\treturn ReplayResponse{StatusCode: response.StatusCode}, errors.New(\"cachebench: provider response read failed\")\n\t}\n\tif int64(len(body)) > transport.maxResponseBytes {\n\t\treturn ReplayResponse{StatusCode: response.StatusCode}, errors.New(\"cachebench: provider response exceeds configured limit\")\n\t}\n\treturn ReplayResponse{\n\t\tStatusCode: response.StatusCode, Body: body,\n\t\tProviderRequestID: providerRequestID(response.Header),\n\t}, nil\n}\n\nfunc (transport *HTTPReplayTransport) endpoint(provider string, outbound ReplayOutbound) (*url.URL, error) {\n\tif !validBoundedText(outbound.Model, 512, false) {\n\t\treturn nil, errors.New(\"cachebench: invalid replay model\")\n\t}\n\tbase := transport.baseURLs[provider]\n\tif provider == \"bedrock\" && base == nil {\n\t\tif !validAWSRegion(outbound.Region) {\n\t\t\treturn nil, errors.New(\"cachebench: invalid Bedrock region\")\n\t\t}\n\t\tparsed, _ := url.Parse(\"https://bedrock-runtime.\" + outbound.Region + \".amazonaws.com\")\n\t\tbase = parsed\n\t}\n\tif base == nil {\n\t\treturn nil, fmt.Errorf(\"cachebench: unsupported replay provider %q\", provider)\n\t}\n\tvar path, rawPath string\n\tswitch provider {\n\tcase \"openai\":\n\t\tif outbound.Endpoint != \"/v1/chat/completions\" && outbound.Endpoint != \"/v1/responses\" {\n\t\t\treturn nil, errors.New(\"cachebench: unsupported OpenAI replay endpoint\")\n\t\t}","sourceCodeStart":149,"sourceCodeEnd":185,"githubUrl":"https://github.com/JuliusBrussee/caveman/blob/766dce6b1394ebb56a3090748d5a0240a5aefb36/cacheengine/cachebench/replay_http.go#L149-L185","documentation":"HTTPReplayTransport.endpoint validates outbound.Model with validBoundedText at up to 512 bytes before building any provider URL. The error fires when the model identifier is empty, exceeds 512 bytes, or contains characters the bounded-text check rejects — the model name is embedded in Gemini and Bedrock URL paths, so it must be well-formed and bounded.","triggerScenarios":"Thrown at cacheengine/cachebench/replay_http.go:167 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Supply a valid model identifier in the replay outbound record","Clean control characters from the model field in replay data"],"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"}