# ERROR: /path/pytest.ini:1: unexpected line: '[tool:pytest]'
# or: pyproject.toml: no [tool.pytest.ini_options] section found

- **ID:** `python/pytest-config-error-nested-ini`
- **Domain:** python
- **Category:** config_error
- **Verification:** ai_generated
- **Fix Rate:** 80%

## Root Cause

The [tool:pytest] section was written in pytest.ini (which expects [pytest]), or the pyproject.toml lacks the required [tool.pytest.ini_options] header.

## Version Compatibility

| Version | Status | Introduced | Deprecated |
|---------|--------|------------|------------|
| 7.x | active | — | — |
| 8.x | active | — | — |

## Workarounds

1. **** (98% success)
   ```
   # pytest.ini
[pytest]
addopts = -ra

# pyproject.toml
[tool.pytest.ini_options]
addopts = '-ra'

# setup.cfg
[tool:pytest]
addopts = -ra
   ```
2. **** (90% success)
   ```
   ls pytest.ini tox.ini setup.cfg pyproject.toml
# Keep exactly one with the correct section; delete or empty the others.
   ```

## Dead Ends

- **** — pytest reads only one config file and ignores the duplicate; the parse error remains or config is silently dropped. (75% fail)
- **** — setup.cfg expects [tool:pytest] but other tools may also read it; renaming alone does not fix the section header inside. (60% fail)
