# panic: sync: Mutex is locked (copied value of sync.Mutex)

- **ID:** `go/mutex-copy-after-use`
- **Domain:** go
- **Category:** runtime_error
- **Verification:** ai_generated
- **Fix Rate:** 80%

## Root Cause

A sync.Mutex is copied after being used, which leads to undefined behavior and panic due to vet or runtime detection.

## Version Compatibility

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

## Workarounds

1. **** (95% success)
   ```
   Always use pointer to the struct that holds the mutex, never copy it. Example: func (m *MyStruct) Lock()
   ```
2. **** (90% success)
   ```
   Use sync.Mutex as a field and embed it in a struct that is always used via pointer.
   ```

## Dead Ends

- **** — Undefined behavior can corrupt data or crash later; not safe. (90% fail)
- **** — Copying the struct still copies the mutex; pointer receiver alone doesn't help. (80% fail)
