# INTERNAL: grpc: decompressed message size 1048576 exceeds max 524288

- **ID:** `grpc/compression-message-size-mismatch`
- **Domain:** grpc
- **Category:** resource_error
- **Error Code:** `EDECOMPRESS`
- **Verification:** ai_generated
- **Fix Rate:** 90%

## Root Cause

After decompression, the message size exceeds the configured max receive message size, causing an internal error even though the compressed size was within limits.

## Version Compatibility

| Version | Status | Introduced | Deprecated |
|---------|--------|------------|------------|
| gRPC v1.58.0 | active | — | — |
| gRPC v1.61.0 | active | — | — |
| gRPC v1.64.0 | active | — | — |

## Workarounds

1. **Increase the client's max receive message size to accommodate the decompressed payload: `channel = grpc.insecure_channel(target, options=[('grpc.max_receive_message_length', 2 * 1024 * 1024)])`** (95% success)
   ```
   Increase the client's max receive message size to accommodate the decompressed payload: `channel = grpc.insecure_channel(target, options=[('grpc.max_receive_message_length', 2 * 1024 * 1024)])`
   ```
2. **On the server side, reduce the uncompressed message size by splitting large responses or using streaming instead of unary calls.** (85% success)
   ```
   On the server side, reduce the uncompressed message size by splitting large responses or using streaming instead of unary calls.
   ```
3. **If using gRPC-Web, ensure the proxy's max buffer size is also increased (e.g., Envoy's `max_request_body_size`).** (80% success)
   ```
   If using gRPC-Web, ensure the proxy's max buffer size is also increased (e.g., Envoy's `max_request_body_size`).
   ```

## Dead Ends

- **Increasing the client's max send message size to match the decompressed size.** — The error is on the receiving side; max send size controls outgoing messages, not incoming decompressed messages. (90% fail)
- **Disabling compression on the server side to avoid decompression entirely.** — This may break clients that rely on compression for performance; it also doesn't address the root cause of the size limit. (50% fail)
- **Setting the environment variable GRPC_MAX_RECEIVE_MESSAGE_LENGTH to a value lower than the compressed size.** — This would reject the message before decompression, worsening the issue. (95% fail)
