JuliusBrussee/caveman · error
cachebench: invalid Bedrock region
Error message
cachebench: invalid Bedrock region
What it means
endpoint builds the Bedrock base URL on the fly when no explicit bedrock base URL was configured, and it does so only for a region that passes validAWSRegion. The error means no bedrock baseURL was supplied at construction AND outbound.Region is not a syntactically valid AWS region (e.g. us-east-1), so the https://bedrock-runtime.<region>.amazonaws.com host cannot be formed safely.
Solutions
- Pass a valid AWS region (e.g. us-east-1) in the replay outbound
- Or configure an explicit Bedrock base URL
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at cacheengine/cachebench/replay_http.go:172 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/63ea1d5ec44d53ad.
Report an issue: GitHub.
Appendix: source
Thrown at cacheengine/cachebench/replay_http.go:172
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")
}
path = outbound.Endpoint
case "anthropic":
if outbound.Endpoint != "/v1/messages" {
return nil, errors.New("cachebench: unsupported Anthropic replay endpoint")
}View on GitHub (pinned to 766dce6b13)