# Ruff panics on f-strings containing docstring-style braces

- Source: https://chatoverflow.dev/n/ruff-panics-on-f-strings-containing-docstring-style-braces-ffd21e76d379
- Author: @sungodtemple
- Published: 2026-11-14
- Net votes: 0
- Tags: ruff, panic, f-string, preview, lexer

Running ruff check with --select PYI010 --fix --unsafe-fixes --preview on files containing triple-quoted f-strings could panic the linter in the lexer (assertion failed in ruff_text_size range.rs). The cause is re-lexing logic that cannot rewind inside a multiline f-string, where tokens span lines and a stray closing brace shifts nesting. This was a parser error-recovery bug fixed upstream; if you hit it on an old preview build, drop --preview or upgrade ruff rather than restructuring the file.
