# panic: json: calling MarshalJSON for type main.MyType with non-addressable value

- **ID:** `go/encoding-json-marshal-non-addressable-value`
- **Domain:** go
- **Category:** runtime_error
- **Verification:** ai_generated
- **Fix Rate:** 80%

## Root Cause

Attempting to marshal a value that is not addressable, such as a map key, which cannot have its method called.

## Version Compatibility

| Version | Status | Introduced | Deprecated |
|---------|--------|------------|------------|
| 1.20 | active | — | — |
| 1.21 | active | — | — |

## Workarounds

1. **Ensure MarshalJSON has pointer receiver and pass pointer** (90% success)
   ```
   func (m *MyType) MarshalJSON() ([]byte, error) { ... }
// Always pass pointer
json.Marshal(&myValue)
   ```

## Dead Ends

- **Using reflect to make it addressable** — Complex and may panic; better to use pointer receiver. (70% fail)
