Quick answer: Godot 4 RichTextLabel showing raw BBCode when player-input contains unmatched tags? Parser fails open - sanitize input before display or use escape_bbcode.

Chat message contains a stray '[b]'. Game shows '[b]rest of message' verbatim because parser gave up.

Escape BBCode

label.text = text.replace("[", "[lb]")

Player-input text shouldn't contain BBCode. Escape brackets; player intent preserved.

Or sanitize whitelist

Allow specific tags ([b], [i]). Strip all others before display. Player gets safe markup.

Validate brackets

Reject messages with unbalanced brackets. Stops the input bug at the gate.

“User input crossing BBCode parser is XSS-adjacent. Sanitize.”

If you ship player-input text rendering, the sanitization is mandatory. Default-trust = bugs and exploits.

Related reading