# proto: required field "pb.User.id" not set

- **ID:** `go/protobuf-required-field-missing`
- **Domain:** go
- **Category:** data_error
- **Verification:** ai_generated
- **Fix Rate:** 80%

## Root Cause

A message defined with proto2 `required` fields was marshaled or unmarshaled without the required field set. Proto3 has no required fields, so this only occurs with proto2 or gogo/protobuf.

## Version Compatibility

| Version | Status | Introduced | Deprecated |
|---------|--------|------------|------------|
| google.golang.org/protobuf 1.x | active | — | — |

## Workarounds

1. **** (90% success)
   ```
   id := int64(42)
msg := &pb.User{Id: &id}
if err := proto.Marshal(msg); err != nil { return err }
   ```
2. **** (85% success)
   ```
   // user.proto (proto3)
message User {
  optional int64 id = 1;
}
   ```

## Dead Ends

- **** — proto2 treats zero value as unset for scalar required fields; still fails. (80% fail)
- **** — Breaking change for existing wire consumers; migration is non-trivial. (50% fail)
