# ClientError: An error occurred (RequestEntityTooLargeException) when calling the Invoke operation: Request must be smaller than 6291556 bytes for the Invoke operation

- **ID:** `aws/lambda-invoke-payload-too-large`
- **Domain:** aws
- **Category:** runtime_error
- **Error Code:** `RequestEntityTooLargeException`
- **Verification:** ai_generated
- **Fix Rate:** 85%

## Root Cause

The payload sent to AWS Lambda via synchronous Invoke exceeds the maximum request size of 6 MB (6,291,556 bytes), causing the API to reject the invocation.

## Version Compatibility

| Version | Status | Introduced | Deprecated |
|---------|--------|------------|------------|
| lambda-2015-03-31 | active | — | — |
| boto3-1.34.0 | active | — | — |

## Workarounds

1. **Use asynchronous invocation (Event invocation) which supports up to 256 KB payload, or use S3 to pass large payloads: upload to S3 and pass the object key to Lambda.** (90% success)
   ```
   Use asynchronous invocation (Event invocation) which supports up to 256 KB payload, or use S3 to pass large payloads: upload to S3 and pass the object key to Lambda.
   ```
2. **Split the payload into smaller chunks and invoke Lambda multiple times, aggregating results client-side.** (80% success)
   ```
   Split the payload into smaller chunks and invoke Lambda multiple times, aggregating results client-side.
   ```
3. **Use Lambda with a function URL or API Gateway, which can handle larger payloads (up to 10 MB) and stream data.** (85% success)
   ```
   Use Lambda with a function URL or API Gateway, which can handle larger payloads (up to 10 MB) and stream data.
   ```

## Dead Ends

- **Increase Lambda function timeout or memory** — Timeout and memory limits affect execution, not the payload size limit; the API rejects before the function runs. (95% fail)
- **Compress the payload with gzip but keep the same structure** — Lambda Invoke API doesn't automatically decompress; the function receives compressed bytes, which may break parsing unless handled explicitly. (60% fail)
