# ConfigParser.MissingSectionHeaderError: File contains no section headers.
file: setup.cfg, line: 1
'[metadata]\n'

- **ID:** `python/setuptools-setup-cfg-parse-error`
- **Domain:** python
- **Category:** config_error
- **Verification:** ai_generated
- **Fix Rate:** 80%

## Root Cause

The setup.cfg file is malformed, missing a section header at the beginning or having incorrect encoding.

## Version Compatibility

| Version | Status | Introduced | Deprecated |
|---------|--------|------------|------------|
| 3.8 | active | — | — |
| 3.9 | active | — | — |
| 3.10 | active | — | — |
| 3.11 | active | — | — |
| 3.12 | active | — | — |

## Workarounds

1. **Ensure the first line is a valid section header like [metadata] or [options]** (95% success)
   ```
   Edit setup.cfg so that line 1 is exactly '[metadata]' without leading spaces.
   ```
2. **Use UTF-8 encoding and no BOM** (90% success)
   ```
   Re-save the file as UTF-8 without BOM using a text editor like VS Code or Notepad++.
   ```

## Dead Ends

- **Adding extra blank lines before [metadata]** — The parser expects the first non-empty line to be a section header. (85% fail)
- **Changing file extension to .txt** — setuptools specifically looks for setup.cfg; renaming breaks detection. (90% fail)
