# error: Multiple top-level packages discovered in a flat-layout: ['src', 'tests', 'docs'].

- **ID:** `python/setuptools-discovery-multiple-top-level`
- **Domain:** python
- **Category:** config_error
- **Verification:** ai_generated
- **Fix Rate:** 80%

## Root Cause

Setuptools auto-discovery in a flat layout finds more than one candidate package directory and refuses to guess which is the real one.

## Version Compatibility

| Version | Status | Introduced | Deprecated |
|---------|--------|------------|------------|
| 3.x | active | — | — |

## Workarounds

1. **** (97% success)
   ```
   [tool.setuptools]
packages = ["mypkg"]
# or
[tool.setuptools.packages.find]
where = ["src"]
include = ["mypkg*"]
   ```
2. **** (95% success)
   ```
   # move mypkg/ to src/mypkg/
[tool.setuptools.packages.find]
where = ["src"]
   ```

## Dead Ends

- **** — MANIFEST.in controls sdist contents, not setuptools package discovery. (85% fail)
- **** — The discovery error occurs during build regardless of isolation. (90% fail)
- **** — Discovery still finds src/ and _tests/ as candidates. (70% fail)
