JuliusBrussee/caveman · error

cachebench: replay body exceeds configured request limit

Error message

cachebench: replay body exceeds configured request limit

What it means

Send rejects the replay request because len(outbound.Body) exceeds maxRequestBytes, the request size cap fixed when the transport was constructed. It fires before any endpoint resolution or network I/O, so an outbound payload larger than the configured replay budget is never transmitted to the provider.

Solutions

  1. Reduce the replay request body size or raise maxRequestBytes (≤256 MiB)
  2. Split oversized replay payloads
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at cacheengine/cachebench/replay_http.go:124 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/441b692e89e920bb. Report an issue: GitHub.

Appendix: source

Thrown at cacheengine/cachebench/replay_http.go:124

		}
	} else {
		clone := *client
		if config.RequestTimeout != 0 || clone.Timeout <= 0 || clone.Timeout > requestTimeout {
			clone.Timeout = requestTimeout
		}
		client = &clone
	}
	client.CheckRedirect = func(_ *http.Request, _ []*http.Request) error { return http.ErrUseLastResponse }
	return &HTTPReplayTransport{client: client, credentials: config.Credentials, baseURLs: parsed, maxRequestBytes: requestLimit, maxResponseBytes: limit}, nil
}

// Send authenticates and sends one bounded provider request without retry.
func (transport *HTTPReplayTransport) Send(ctx context.Context, outbound ReplayOutbound) (ReplayResponse, error) {
	if transport == nil || transport.client == nil {
		return ReplayResponse{}, errors.New("cachebench: nil HTTP replay transport")
	}
	if int64(len(outbound.Body)) > transport.maxRequestBytes {
		return ReplayResponse{}, errors.New("cachebench: replay body exceeds configured request limit")
	}
	provider := strings.ToLower(strings.TrimSpace(outbound.Provider))
	if !validBoundedText(provider, 64, false) {
		return ReplayResponse{}, errors.New("cachebench: invalid replay provider")
	}
	endpoint, err := transport.endpoint(provider, outbound)
	if err != nil {
		return ReplayResponse{}, err
	}
	if !validUniqueJSONObject(outbound.Body) {
		return ReplayResponse{}, errors.New("cachebench: replay body must be one JSON object")
	}
	request, err := http.NewRequestWithContext(ctx, http.MethodPost, endpoint.String(), bytes.NewReader(outbound.Body))
	if err != nil {
		return ReplayResponse{}, errors.New("cachebench: could not build provider request")
	}
	request.Header.Set("content-type", "application/json")
	request.Header.Set("accept", "application/json")

View on GitHub (pinned to 766dce6b13)