# InvalidOperationException: Physics.Raycast query may hit the same collider multiple times if the collider is not set to QueryTriggerInteraction.Ignore

- **ID:** `unity/physics-query-hits-self`
- **Domain:** unity
- **Category:** runtime_error
- **Verification:** ai_generated
- **Fix Rate:** 91%

## Root Cause

A Physics.RaycastNonAlloc call returns duplicate hits when the collider is a trigger and QueryTriggerInteraction.UseGlobal is set, causing array overflow.

## Version Compatibility

| Version | Status | Introduced | Deprecated |
|---------|--------|------------|------------|
| Unity 2022.3 | active | — | — |
| Unity 2023.1 | active | — | — |
| Unity 2023.2 | active | — | — |
| Unity 6000.0 | active | — | — |

## Workarounds

1. **Set QueryTriggerInteraction.Ignore in the RaycastNonAlloc call to ignore trigger colliders.** (95% success)
   ```
   Set QueryTriggerInteraction.Ignore in the RaycastNonAlloc call to ignore trigger colliders.
   ```
2. **Use Physics.RaycastAll instead and deduplicate hits by collider instance ID.** (92% success)
   ```
   Use Physics.RaycastAll instead and deduplicate hits by collider instance ID.
   ```

## Dead Ends

- **** — The error occurs because the same collider is hit multiple times, not because the buffer is too small. (90% fail)
- **** — Changing isTrigger alters collision behavior and may not be acceptable for the game design. (70% fail)
