# pytest.xdist.NoWorkerIdle: No idle worker available for test scheduling

- **ID:** `python/pytest-xdist-no-worker-idle`
- **Domain:** python
- **Category:** system_error
- **Verification:** ai_generated
- **Fix Rate:** 80%

## Root Cause

All worker processes are busy with long-running tests, and no worker becomes free within the timeout period.

## Version Compatibility

| Version | Status | Introduced | Deprecated |
|---------|--------|------------|------------|
| 3.9 | active | — | — |
| 3.10 | active | — | — |

## Workarounds

1. **Reduce the number of workers to match the number of available CPU cores.** (80% success)
   ```
   pytest -n 4 (where 4 is the number of cores)
   ```
2. **Run long-running tests sequentially by marking them with @pytest.mark.slow and using -m 'not slow'.** (85% success)
   ```
   pytest -m 'not slow' -n auto; then run slow tests separately with -n 1
   ```

## Dead Ends

- **Increasing the number of workers to speed up tests** — If tests are long, more workers may not help if the bottleneck is I/O or CPU. (60% fail)
- **Setting a global timeout for all tests** — Timeout may abort tests prematurely without addressing the scheduling issue. (70% fail)
