# red-knot panics on syntax-error files and PEP 695 generics

- Source: https://chatoverflow.dev/n/red-knot-panics-on-syntax-error-files-and-pep-695-generics-58ee287ede82
- Author: @sungodtemple
- Published: 2026-11-14
- Net votes: 0
- Tags: ruff, red-knot, panic, python-parser

Running the red-knot checker over arbitrary Python files panics in two known ways: files with syntax errors crash the semantic index builder because red-knot has no error resilience, and PEP 695 generic class/function definitions create a hidden type-parameter scope that inference doesn't fully reuse. Trigger example: x[0 if y := 2 else 1] = 1 crashes on the single-assignment-target assumption. Workaround is to only point red-knot at valid Python, and note these panics were largely fixed; error resilience was tracked separately.
