{"record":{"id":"04cad23073f98145","repo":"JuliusBrussee/caveman","slug":"cacheengine-request-exceeds-configured-byte-limit","errorCode":null,"errorMessage":"cacheengine: request exceeds configured byte limit","messagePattern":"cacheengine: request exceeds configured byte limit","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cacheengine/native.go","lineNumber":32,"sourceCode":")\n\n// Optimize applies provider-native cache metadata or returns copied original\n// bytes on every unsupported or unsafe path. It makes no network call.\nfunc (e *Engine) Optimize(ctx context.Context, request NativeRequest) (NativeResult, error) {\n\tif e == nil || e.guard == nil || e.prefixSafety == nil || e.resolveProfile == nil {\n\t\treturn NativeResult{}, errors.New(\"cacheengine: nil engine\")\n\t}\n\tif e.configErr != nil {\n\t\treturn NativeResult{}, e.configErr\n\t}\n\tif ctx == nil {\n\t\treturn NativeResult{}, errors.New(\"cacheengine: nil context\")\n\t}\n\tif err := ctx.Err(); err != nil {\n\t\treturn NativeResult{}, err\n\t}\n\tif len(request.Body) > e.maxRequestBytes {\n\t\treturn NativeResult{}, errors.New(\"cacheengine: request exceeds configured byte limit\")\n\t}\n\toriginal := append([]byte(nil), request.Body...)\n\tunsupported := Profile{ID: \"unsupported\", Mode: ModeUnsupported, Attribution: AttributionNone}\n\tresult := NativeResult{\n\t\tBody:     original,\n\t\tDecision: DecisionPassThrough,\n\t\tReason:   ReasonUnsupported,\n\t\tProfile:  unsupported,\n\t\tPlan: Plan{\n\t\t\tDecision: DecisionPassThrough, Reason: ReasonUnsupported,\n\t\t\tProfileID: unsupported.ID, Mode: unsupported.Mode, Attribution: unsupported.Attribution,\n\t\t\tEconomicsBasis: \"unavailable\", KeyShardCount: 1,\n\t\t},\n\t\tClaimBasis:         \"none\",\n\t\tVerifiedSavingsUSD: 0,\n\t}\n\tif !validNativeIdentity(request) {\n\t\tresult.Reason = ReasonMalformedRequest","sourceCodeStart":14,"sourceCodeEnd":50,"githubUrl":"https://github.com/JuliusBrussee/caveman/blob/766dce6b1394ebb56a3090748d5a0240a5aefb36/cacheengine/native.go#L14-L50","documentation":"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.","triggerScenarios":"Thrown at cacheengine/native.go:32 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Reduce the request payload below the configured limit","Raise config.MaxRequestBytes when legitimately larger requests must be optimized"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"766dce6b1394ebb56a3090748d5a0240a5aefb36","analyzedAt":"2026-08-18T03:14:35.516Z","contentChangedAt":"2026-08-18T03:14:35.516Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}