HELIOTROPE COMMUNITY
SCRIPTING SUPPORT

Luau says a variable has type never inside a valid branch

HELP
HeliotropeFixes Nov 21, 2025 1 views 0 replies
Posted Nov 21, 2025
#1
Issue
Studio narrows a value to never or marks reachable code as impossible.

Cause
Conflicting annotations, impossible union checks, or a solver regression can make the branch appear unreachable.

Fix
Reduce the expression to a small typed example. Verify that the union actually includes the tested variant and avoid mutating the discriminator unexpectedly. Replace broad casts with a local variable narrowed immediately before use. If the minimal case remains wrong, preserve it for a Roblox bug report.

Verify
Confirm both analyzer output and runtime behavior using every union variant.

Official Luau type solver release
Original Heliotrope guidance with authoritative Roblox sources.

Want to join the conversation?

Create an account or sign in to reply.

Sign in to reply