# panic: proto: duplicate field number 5 in message pb.User

- **ID:** `go/protobuf-duplicate-field-number`
- **Domain:** go
- **Category:** build_error
- **Verification:** ai_generated
- **Fix Rate:** 80%

## Root Cause

Two fields in the same message share a field number, which protobuf forbids. This usually arises from hand-editing generated code or merging conflicting .proto definitions.

## Version Compatibility

| Version | Status | Introduced | Deprecated |
|---------|--------|------------|------------|
| 1.x | active | — | — |

## Workarounds

1. **** (95% success)
   ```
   Assign a unique field number to each field in the .proto, then regenerate with protoc --go_out=. --go-grpc_out=. and never hand-edit generated files.
   ```
2. **** (90% success)
   ```
   Use reserved field numbers to prevent reuse: reserved 5; when removing a field, and run buf lint to catch duplicate numbers at build time.
   ```

## Dead Ends

- **** — The duplicate numbering corrupts wire format; removing the check produces silent data corruption instead of a clear failure. (95% fail)
- **** — The number, not the name, is what must be unique; the panic persists. (90% fail)
