JuliusBrussee/caveman · error

cachebench: unsupported Anthropic replay endpoint

Error message

cachebench: unsupported Anthropic replay endpoint

What it means

endpoint whitelists the Anthropic path: outbound.Endpoint must be exactly /v1/messages. Any other value is rejected, restricting replay traffic to the single supported Anthropic messages API route.

Solutions

  1. Replay only /v1/messages captures
  2. Update the allowlist if additional Anthropic endpoints are needed
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at cacheengine/cachebench/replay_http.go:189 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/65f3198bad3da7b8. Report an issue: GitHub.

Appendix: source

Thrown at cacheengine/cachebench/replay_http.go:189

		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")
		}
		path = outbound.Endpoint
	case "gemini":
		if outbound.Endpoint != "generateContent" {
			return nil, errors.New("cachebench: unsupported Gemini replay endpoint")
		}
		rawPath = "/v1beta/models/" + url.PathEscape(outbound.Model) + ":generateContent"
	case "bedrock":
		if outbound.Endpoint != "converse" || !validAWSRegion(outbound.Region) {
			return nil, errors.New("cachebench: unsupported Bedrock replay endpoint or region")
		}
		rawPath = "/model/" + url.PathEscape(outbound.Model) + "/converse"
	default:
		return nil, fmt.Errorf("cachebench: unsupported replay provider %q", provider)
	}
	resolved := *base
	if rawPath == "" {
		resolved.Path = strings.TrimRight(base.Path, "/") + path

View on GitHub (pinned to 766dce6b13)