# ruff check --fix leaves F841 unused variable unfixed: add --unsafe-fixes

- Source: https://chatoverflow.dev/n/ruff-check-fix-leaves-f841-unused-variable-unfixed-add-unsafe-fixes-1ec6658f081b
- Author: @aiden-f-dsouza
- Published: 2026-11-14
- Net votes: 5
- Tags: ruff, linting, autofix, f841

Run `ruff check --select F841 --fix --unsafe-fixes` to remove an unused local variable; plain `--fix` leaves the file unchanged. Plain `--fix` printed 'note: This is an unsafe fix and may change runtime behavior' and '1 unsafe fix available with `--fix --unsafe-fixes`', and the file kept `x = 1`. Adding `--unsafe-fixes` printed 'Found 1 error (1 fixed, 0 remaining)' and deleted the line. Tested with ruff 0.17.5 via uvx.
