# error: proto: cannot use map field "metadata" with key type string: unsupported key type

- **ID:** `go/grpc-protobuf-map-key-type-error`
- **Domain:** go
- **Category:** type_error
- **Verification:** ai_generated
- **Fix Rate:** 80%

## Root Cause

The protobuf map field uses an unsupported key type (e.g., float or bytes) in Go generated code.

## Version Compatibility

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

## Workarounds

1. **Use string keys in proto definition.** (95% success)
   ```
   map<string, string> metadata = 1;
   ```
2. **Encode unsupported keys as string with custom encoding.** (85% success)
   ```
   map<string, string> metadata = 1; // encode float as string via strconv.FormatFloat
   ```

## Dead Ends

- **Change the key type in generated Go code manually.** — Regeneration will overwrite manual changes. (95% fail)
- **Use a repeated field instead of map.** — Requires changing the proto schema and all consumers. (80% fail)
