JuliusBrussee/caveman · error

cacheengine: request exceeds configured byte limit

Error message

cacheengine: request exceeds configured byte limit

What it means

The native request payload exceeds the engine's configured MaxRequestBytes (default input byte limit). Optimize bounds retained request bytes to cap memory; oversized inputs are refused before any splicing or metadata application.

Solutions

  1. Reduce the request payload below the configured limit
  2. Raise config.MaxRequestBytes when legitimately larger requests must be optimized
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at cacheengine/native.go:32 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/04cad23073f98145. Report an issue: GitHub.

Appendix: source

Thrown at cacheengine/native.go:32

)

// Optimize applies provider-native cache metadata or returns copied original
// bytes on every unsupported or unsafe path. It makes no network call.
func (e *Engine) Optimize(ctx context.Context, request NativeRequest) (NativeResult, error) {
	if e == nil || e.guard == nil || e.prefixSafety == nil || e.resolveProfile == nil {
		return NativeResult{}, errors.New("cacheengine: nil engine")
	}
	if e.configErr != nil {
		return NativeResult{}, e.configErr
	}
	if ctx == nil {
		return NativeResult{}, errors.New("cacheengine: nil context")
	}
	if err := ctx.Err(); err != nil {
		return NativeResult{}, err
	}
	if len(request.Body) > e.maxRequestBytes {
		return NativeResult{}, errors.New("cacheengine: request exceeds configured byte limit")
	}
	original := append([]byte(nil), request.Body...)
	unsupported := Profile{ID: "unsupported", Mode: ModeUnsupported, Attribution: AttributionNone}
	result := NativeResult{
		Body:     original,
		Decision: DecisionPassThrough,
		Reason:   ReasonUnsupported,
		Profile:  unsupported,
		Plan: Plan{
			Decision: DecisionPassThrough, Reason: ReasonUnsupported,
			ProfileID: unsupported.ID, Mode: unsupported.Mode, Attribution: unsupported.Attribution,
			EconomicsBasis: "unavailable", KeyShardCount: 1,
		},
		ClaimBasis:         "none",
		VerifiedSavingsUSD: 0,
	}
	if !validNativeIdentity(request) {
		result.Reason = ReasonMalformedRequest

View on GitHub (pinned to 766dce6b13)