# Protobuf deserialization fails with 'Unknown enum value' when reading data with new enum values

- **ID:** `data/protobuf-unknown-enum-value`
- **Domain:** data
- **Category:** schema_error
- **Error Code:** `InvalidProtocolBufferException`
- **Verification:** ai_generated
- **Fix Rate:** 85%

## Root Cause

A new enum value was added to a Protobuf definition, but the reader's generated code is not updated, causing it to reject the unknown value instead of treating it as an unrecognized field.

## Version Compatibility

| Version | Status | Introduced | Deprecated |
|---------|--------|------------|------------|
| Protocol Buffers 3.21+ | active | — | — |
| protoc 24.0+ | active | — | — |
| gRPC 1.60+ | active | — | — |

## Workarounds

1. **Update the reader to use the latest .proto file and regenerate the code. For Java: run `protoc --java_out=src/main/java myproto.proto` with the updated definition.** (100% success)
   ```
   Update the reader to use the latest .proto file and regenerate the code. For Java: run `protoc --java_out=src/main/java myproto.proto` with the updated definition.
   ```
2. **Use the `allow_alias` option in the .proto file to map the new enum value to an existing one as a temporary measure: `option allow_alias = true; NEW_VALUE = EXISTING_VALUE;`** (70% success)
   ```
   Use the `allow_alias` option in the .proto file to map the new enum value to an existing one as a temporary measure: `option allow_alias = true; NEW_VALUE = EXISTING_VALUE;`
   ```
3. **Treat the field as `google.protobuf.Int32Value` wrapper to bypass enum validation, then convert the integer to the appropriate enum in application code.** (75% success)
   ```
   Treat the field as `google.protobuf.Int32Value` wrapper to bypass enum validation, then convert the integer to the appropriate enum in application code.
   ```

## Dead Ends

- **** — The reader still runs old code; regenerating without redeployment has no effect. (100% fail)
- **** — Enums in proto3 are already implicitly optional; making them explicit does not change how unknown values are handled. (80% fail)
- **** — Protobuf's generated code throws an exception during deserialization that cannot be easily caught without modifying the generated code itself. (65% fail)
