# rpc error: code = Internal desc = grpc: error while unmarshaling: proto: cannot parse invalid wire-format data

- **ID:** `go/grpc-internal-error-codec-mismatch`
- **Domain:** go
- **Category:** type_error
- **Verification:** ai_generated
- **Fix Rate:** 80%

## Root Cause

The server received data that is not valid protobuf, often due to codec mismatch or data corruption.

## Version Compatibility

| Version | Status | Introduced | Deprecated |
|---------|--------|------------|------------|
| 1.0 | active | — | — |
| 1.1 | active | — | — |

## Workarounds

1. **Ensure both client and server use the same protobuf version and schema.** (90% success)
   ```
   Run 'protoc --go_out=. --go-grpc_out=. *.proto' on both sides and rebuild.
   ```
2. **Add logging to inspect the raw bytes received.** (70% success)
   ```
   Use a server interceptor to log incoming data for debugging:
func loggingInterceptor(ctx context.Context, req interface{}, info *grpc.UnaryServerInfo, handler grpc.UnaryHandler) (interface{}, error) {
    log.Printf("request: %v", req)
    return handler(ctx, req)
}
   ```

## Dead Ends

- **Assume the data is fine and retry.** — If the data is malformed, retrying will produce the same error. (100% fail)
- **Change the protobuf schema without regenerating code.** — The server and client must use the same schema; manual changes cause incompatibility. (95% fail)
