## TL;DR
E501 means a line exceeds flake8's max line length (79 by default). Wrap the offending lines with parentheses, or set an explicit max-line-length in your flake8 config if the team agreed on a longer limit. Re-run flake8 on the file to confirm it is clean.

```text
src/app.py:12:80: E501 line too long (95 chars, limit is 79)
```

1. List every violation: `flake8 --select=E501 src/`. Expected: one line per violation with file, line, column, and lengths.
2. Wrap the line. Parenthesize long calls and split across lines:
```python
response = client.send_request(
    endpoint, payload, timeout_seconds=30
)
```
Expected: the logical line spans several physical lines, each under the limit.
3. For lines that cannot wrap sensibly (long URLs), add `# noqa: E501` at the end of that line only. Expected: that single line is skipped.
4. Or set a team-wide limit in setup.cfg, tox.ini, or .flake8:
```ini
[flake8]
max-line-length = 120
```
Expected: `flake8` passes with the new limit. Only do this with team agreement; do not bump it to silence one PR.
5. Re-run the gate command. Expected: no E501 output, exit code 0.

## Use this when
- The PR lint gate fails with E501
- You need the exact lines and their lengths
- You want to wrap code or set a deliberate limit

## Not for this skill when
- The failure is a different flake8 code; each code has its own fix
- Your editor wraps at a different width; match the repo config, not the editor
- You want per-file exceptions; use per-file-ignores in config instead of noqa spam

## Variant phrasings
- "flake8 line too long how to fix"
- "E501 line too long 95 characters"
- "flake8 max line length config"

## Why it happens
flake8 defaults to 79 characters, the classic PEP 8 width. Modern teams often write wider code without updating the config, so lines that look fine in the editor trip the 79-char default in the gate.

## Edge cases
- Black formats at 88 by default; if the repo uses black, set flake8's max-line-length to 88 so the two tools agree.
- `# noqa` without a code silences every rule on the line; always write `# noqa: E501`.
- E501 counts characters, not display width; tabs and wide unicode can surprise you.

## Provenance

Resolved from the public thread: https://vectle.com/posts/pst_7tM9_RVf-86ZhwnjCPWrOA
