Tested on gdscript-formatter 0.21.0 (Pre-release 0.21.0-beta, published 2026-07-12), Linux x86_64. Upstream main checked up to 248fa13b (2026-07-12 09:20 UTC) — no fix commit found.
Impact
Formatter panics with exit 1 and produces no output. --reorder-code fails outright; plain format also panics on the same input. Any project that uses non-ASCII identifiers has affected files silently skipped by tooling.
Minimal repro
Entire .gd file, 1 line:
Command:
gdscript-formatter --stdout --reorder-code bug.gd
Actual output
Formatting 1 file...
thread '<unnamed>' (pid) panicked at src/node_kind.rs:194:9:
index out of bounds: the len is 256 but the index is 65535
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
thread 'main' (pid) panicked at src/main.rs:293:38:
worker thread panicked: Any { .. }
Same panic without --reorder-code.
Expected
Format completes and returns:
Boundary (verified individually on 0.21.0-beta)
Does NOT panic (non-ASCII is safe in these positions):
- inside a
# comment
- inside a plain string literal
"あいうえお"
- inside a StringName literal
&"あいうえお"
- inside a
res://.../日本語/... path string
DOES panic (non-ASCII in an identifier position is the trigger):
- variable name:
var 変数: int
- const name:
const _状態 := &"..."
- function / parameter name:
func 判定(値: String) -> bool: return 値 == "test"
match arm literal referring to Japanese identifiers indirectly
So the necessary and sufficient condition is a non-ASCII character appearing in an identifier position.
Hypothesis
src/node_kind.rs:194:9 doing an indexed lookup with a u16 value that overflows to 65535 (u16::MAX) when the lexer/parser encounters an identifier byte outside the ASCII range. The len is 256 in the error suggests a 256-entry table keyed by a u8/enum discriminant.
Tested on
gdscript-formatter 0.21.0(Pre-release0.21.0-beta, published 2026-07-12), Linux x86_64. Upstreammainchecked up to248fa13b(2026-07-12 09:20 UTC) — no fix commit found.Impact
Formatter panics with exit 1 and produces no output.
--reorder-codefails outright; plain format also panics on the same input. Any project that uses non-ASCII identifiers has affected files silently skipped by tooling.Minimal repro
Entire
.gdfile, 1 line:Command:
Actual output
Same panic without
--reorder-code.Expected
Format completes and returns:
Boundary (verified individually on 0.21.0-beta)
Does NOT panic (non-ASCII is safe in these positions):
# comment"あいうえお"&"あいうえお"res://.../日本語/...path stringDOES panic (non-ASCII in an identifier position is the trigger):
var 変数: intconst _状態 := &"..."func 判定(値: String) -> bool: return 値 == "test"matcharm literal referring to Japanese identifiers indirectlySo the necessary and sufficient condition is a non-ASCII character appearing in an identifier position.
Hypothesis
src/node_kind.rs:194:9doing an indexed lookup with au16value that overflows to65535(u16::MAX) when the lexer/parser encounters an identifier byte outside the ASCII range. Thelen is 256in the error suggests a 256-entry table keyed by au8/enum discriminant.