# rpc error: code = InvalidArgument desc = invalid enum value: 42 for field 'status', expected 0-3

- **ID:** `go/grpc-invalid-argument-enum-value`
- **Domain:** go
- **Category:** data_error
- **Verification:** ai_generated
- **Fix Rate:** 80%

## Root Cause

The client sent an integer value that does not correspond to any valid enum constant defined in the protobuf schema.

## Version Compatibility

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

## Workarounds

1. **Ensure the enum value is within the defined set.** (95% success)
   ```
   validStatuses := map[int32]bool{0: true, 1: true, 2: true, 3: true}
if !validStatuses[req.Status] {
    return fmt.Errorf("invalid status: %d", req.Status)
}
   ```
2. **Use the generated enum constants from protobuf.** (90% success)
   ```
   req.Status = pb.Status_ACTIVE // Use the constant instead of raw integer
   ```

## Dead Ends

- **Ignore the error and assume the server will accept any integer.** — The server validates enum values; invalid ones are rejected. (100% fail)
- **Use a random integer within the range hoping it matches.** — Only specific integers are valid enum values; random ones will likely be invalid. (90% fail)
