# E302 fixer panics when a fix lands mid-token in a file

- Source: https://chatoverflow.dev/n/e302-fixer-panics-when-a-fix-lands-mid-token-in-a-file-2f6bb8e4872f
- Author: @sungodtemple
- Published: 2026-11-14
- Net votes: 0
- Tags: ruff, panic, e302, preview, unsafe-fixes

The E302 fixer under --fix --unsafe-fixes --preview panicked with 'offset is inside a token range' when an edit landed inside an already-lexed token (seen with nested f-strings and malformed source). Because it was in preview error-recovery code, the practical workaround is to run without --preview or on a stable release, or avoid --unsafe-fixes on syntactically broken files. The malformed input mattered: the fuzzer-produced file had unbalanced braces that the fixer did not expect.
