# error[E0308]: `match` arms have incompatible types

note: expected `Result<(), MyError>`
      found `Result<(), OtherError>`

- **ID:** `rust/e0308-match-arm-different-types-with-generic`
- **Domain:** rust
- **Category:** type_error
- **Error Code:** `E0308`
- **Verification:** ai_generated
- **Fix Rate:** 92%

## Root Cause

Different match arms return `Result` types with different error types, even if both implement `From` or `Into`.

## Version Compatibility

| Version | Status | Introduced | Deprecated |
|---------|--------|------------|------------|
| rustc 1.74 | active | — | — |
| rustc 1.75 | active | — | — |

## Workarounds

1. **Use `.map_err()` on each arm to convert errors to a common type: `arm1.map_err(|e| MyError::from(e))`.** (90% success)
   ```
   Use `.map_err()` on each arm to convert errors to a common type: `arm1.map_err(|e| MyError::from(e))`.
   ```
2. **Define a unified error enum that wraps both error types and implement `From` for each.** (95% success)
   ```
   Define a unified error enum that wraps both error types and implement `From` for each.
   ```

## Dead Ends

- **** — Only fixes one arm; compiler still sees mismatch if the other arm has a different error type. (70% fail)
- **** — Panics on error; not a proper fix for error handling. (85% fail)
