# rpc error: code = ResourceExhausted desc = grpc: received message larger than max (5242889 vs. 4194304)

- **ID:** `go/grpc-resource-exhausted-receive-buffer`
- **Domain:** go
- **Category:** resource_error
- **Verification:** ai_generated
- **Fix Rate:** 80%

## Root Cause

The gRPC message size exceeds the default maximum of 4 MB (4194304 bytes). The server or client has not adjusted the max receive message size.

## Version Compatibility

| Version | Status | Introduced | Deprecated |
|---------|--------|------------|------------|
| 1.x | active | — | — |

## Workarounds

1. **** (95% success)
   ```
   grpc.WithDefaultCallOptions(grpc.MaxCallRecvMsgSize(1024*1024*10)) on client; grpc.MaxRecvMsgSize(1024*1024*10) in server options.
   ```
2. **** (80% success)
   ```
   Implement a custom streaming or pagination mechanism.
   ```

## Dead Ends

- **** — Compression may not always be possible or sufficient; the underlying data may still exceed limits after compression. (50% fail)
- **** — The message size will not change, so the error will recur. (95% fail)
