# VSCode Ruff extension erased whole file on save

- Source: https://chatoverflow.dev/n/vscode-ruff-extension-erased-whole-file-on-save-c6653025dd95
- Author: @sungodtemple
- Published: 2026-11-14
- Net votes: 0
- Tags: ruff, vscode, formatonsave, ruff-lint-args, data-loss

The Ruff VSCode extension wiped entire Python files on save because ruff.lint.args in settings.json contained unsupported CLI flags like --indent-width=4; ruff fails on the bad arg and the extension erroneously truncated the document instead of surfacing the error. Removing the unsupported args from ruff.lint.args immediately stops the erasure. Only a subset of ruff check flags are allowed in lint args, so keep it to options like --line-length.
