# error: proto: cannot parse invalid wire-format data

- **ID:** `go/grpc-protobuf-unmarshal-field-mismatch`
- **Domain:** go
- **Category:** data_error
- **Verification:** ai_generated
- **Fix Rate:** 80%

## Root Cause

The protobuf message received over gRPC has a field with an unexpected wire type, often due to schema mismatch between client and server.

## Version Compatibility

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

## Workarounds

1. **Regenerate Go protobuf code from the same .proto file on both sides.** (95% success)
   ```
   protoc --go_out=. --go-grpc_out=. *.proto
   ```
2. **Use protojson format for debugging to identify field type mismatches.** (80% success)
   ```
   import "google.golang.org/protobuf/encoding/protojson"
b, _ := protojson.Marshal(msg)
log.Printf("%s", b)
   ```

## Dead Ends

- **Restart both client and server without checking proto files.** — The issue is structural mismatch, not transient state. (90% fail)
- **Update only the client binary without regenerating proto code.** — Stale generated code still has old field definitions. (85% fail)
