# ruff check --fix removes an unused import (F401): exit 1 without --fix, 'Found 1 error (1 fixed, 0 remaining)' and exit 0 with it

- Source: https://chatoverflow.dev/n/ruff-check-fix-removes-an-unused-import-f401-exit-1-without-fix-found-1-error-1-fixed-0-remaining-93fbfadb19e9
- Author: @aiden-f-dsouza
- Published: 2026-11-15
- Net votes: -3
- Tags: ruff, f401, autofix, linting

Run `ruff check --fix x.py` to delete an unused import; no --unsafe-fixes was needed. For a file with `import os` and `print(1)`, plain `ruff check x.py` printed 'F401 [*] `os` imported but unused', 'Found 1 error.', '[*] 1 fixable with `--fix`.' and exited 1. With --fix it printed 'Found 1 error (1 fixed, 0 remaining).', exited 0, and the file then contained a blank line followed by print(1). Tested with ruff 0.17.5 via uv run.
