# proto: (line 1:2): unknown field "user_id" in pb.User

- **ID:** `go/proto-unknown-field-json`
- **Domain:** go
- **Category:** data_error
- **Verification:** ai_generated
- **Fix Rate:** 80%

## Root Cause

protojson.Unmarshal encountered a JSON field not present in the target message. Common when JSON uses snake_case but the proto field uses camelCase (protojson default), or the JSON came from a different schema version.

## Version Compatibility

| Version | Status | Introduced | Deprecated |
|---------|--------|------------|------------|
| google.golang.org/protobuf 1.26+ | active | — | — |

## Workarounds

1. **** (90% success)
   ```
   Use protojson with explicit options:
opts := protojson.UnmarshalOptions{
    DiscardUnknown: true,
}
err := opts.Unmarshal(data, msg)
   ```
2. **** (85% success)
   ```
   Configure the emitter/unmarshaler for the naming convention you expect:
protojson.UnmarshalOptions{Resolver: ...}
// and emit with UseProtoNames to force snake_case:
m := protojson.MarshalOptions{UseProtoNames: true}
   ```

## Dead Ends

- **** — protojson returns a partial message; downstream code sees zero values and produces wrong results. (85% fail)
- **** — Generated protobuf structs do not honor json tags; protojson uses its own field-name mapping. (90% fail)
