JuliusBrussee/caveman · error
cachebench: invalid replay model
Error message
cachebench: invalid replay model
What it means
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.
Solutions
- Supply a valid model identifier in the replay outbound record
- Clean control characters from the model field in replay data
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at cacheengine/cachebench/replay_http.go:167 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of JuliusBrussee/caveman@766dce6b13 (2026-08-18).
Data as JSON: /api/errors/9633a59d637af52d.
Report an issue: GitHub.
Appendix: source
Thrown at cacheengine/cachebench/replay_http.go:167
return ReplayResponse{}, errors.New("cachebench: provider request failed")
}
defer response.Body.Close()
body, err := io.ReadAll(io.LimitReader(response.Body, transport.maxResponseBytes+1))
if err != nil {
return ReplayResponse{StatusCode: response.StatusCode}, errors.New("cachebench: provider response read failed")
}
if int64(len(body)) > transport.maxResponseBytes {
return ReplayResponse{StatusCode: response.StatusCode}, errors.New("cachebench: provider response exceeds configured limit")
}
return ReplayResponse{
StatusCode: response.StatusCode, Body: body,
ProviderRequestID: providerRequestID(response.Header),
}, nil
}
func (transport *HTTPReplayTransport) endpoint(provider string, outbound ReplayOutbound) (*url.URL, error) {
if !validBoundedText(outbound.Model, 512, false) {
return nil, errors.New("cachebench: invalid replay model")
}
base := transport.baseURLs[provider]
if provider == "bedrock" && base == nil {
if !validAWSRegion(outbound.Region) {
return nil, errors.New("cachebench: invalid Bedrock region")
}
parsed, _ := url.Parse("https://bedrock-runtime." + outbound.Region + ".amazonaws.com")
base = parsed
}
if base == nil {
return nil, fmt.Errorf("cachebench: unsupported replay provider %q", provider)
}
var path, rawPath string
switch provider {
case "openai":
if outbound.Endpoint != "/v1/chat/completions" && outbound.Endpoint != "/v1/responses" {
return nil, errors.New("cachebench: unsupported OpenAI replay endpoint")
}View on GitHub (pinned to 766dce6b13)