# java.lang.IllegalArgumentException: navigation destination com.example:id/destination1 is not a valid NavDestination for action com.example:id/action_to_destination2

- **ID:** `android/navigation-compose-illegalargumentexception`
- **Domain:** android
- **Category:** runtime_error
- **Verification:** ai_generated
- **Fix Rate:** 90%

## Root Cause

Navigation graph misconfiguration: action references a destination not defined in the same navigation graph or route mismatch.

## Version Compatibility

| Version | Status | Introduced | Deprecated |
|---------|--------|------------|------------|
| Navigation Compose 2.6.0 | active | — | — |
| AndroidX Activity 1.7.0 | active | — | — |
| Kotlin 1.9.0 | active | — | — |

## Workarounds

1. **In NavHost composable, ensure all destinations are added: composable("destination1") { ... }. Then navigate using named routes: navController.navigate("destination2") instead of action IDs.** (90% success)
   ```
   In NavHost composable, ensure all destinations are added: composable("destination1") { ... }. Then navigate using named routes: navController.navigate("destination2") instead of action IDs.
   ```
2. **Regenerate navigation graph using Android Studio's Navigation Editor: right-click res/navigation/*.xml -> Open with Editor -> validate all actions and destinations.** (85% success)
   ```
   Regenerate navigation graph using Android Studio's Navigation Editor: right-click res/navigation/*.xml -> Open with Editor -> validate all actions and destinations.
   ```

## Dead Ends

- **Removing and re-adding the navigation graph resource file without checking IDs** — ID references may still be stale; requires verifying each action-destination mapping in the XML. (60% fail)
- **Hardcoding route strings instead of using generated NavDirections** — Bypasses type safety but still fails if route strings don't match graph; also breaks navigation arguments. (75% fail)
