# proto: required field "user.id" not set

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

## Root Cause

A proto2 message has a required field that was not populated before marshaling. proto3 removed required, but proto2 (and some migrated schemas) still enforce it.

## Version Compatibility

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

## Workarounds

1. **** (90% success)
   ```
   Populate required fields before marshal, or migrate the schema to proto3:
msg := &pb.User{Id: userID, Name: name}
if err := proto.Marshal(msg); err != nil { return err }
   ```
2. **** (85% success)
   ```
   If the field truly is optional, edit the .proto to remove `required` and regenerate:
// user.proto
message User { optional string id = 1; }
   ```

## Dead Ends

- **** — Produces wire bytes that downstream strict servers reject; the field is still missing. (60% fail)
- **** — proto2 distinguishes 'unset' from 'zero'; setting zero still counts as set only if you explicitly assign it — but semantically you're sending bad data. (75% fail)
