JuliusBrussee/caveman · error

cachebench: unsupported Gemini replay endpoint

Error message

cachebench: unsupported Gemini replay endpoint

What it means

endpoint whitelists the Gemini path: outbound.Endpoint must be exactly the literal 'generateContent' (the model-specific prefix /v1beta/models/<model>: is built by the transport itself). Any other value is rejected, so arbitrary Gemini API paths cannot be reached through replay.

Solutions

  1. Replay only generateContent captures
  2. Extend the allowlist for other Gemini operations
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at cacheengine/cachebench/replay_http.go:194 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/590c39130e61549d. Report an issue: GitHub.

Appendix: source

Thrown at cacheengine/cachebench/replay_http.go:194

	}
	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
		resolved.RawPath = ""
	} else {
		resolved.RawPath = strings.TrimRight(base.EscapedPath(), "/") + rawPath
		resolved.Path, _ = url.PathUnescape(resolved.RawPath)
	}

View on GitHub (pinned to 766dce6b13)