How a Terraform error string crashed a Textual TUI and what finally fixed it
A developer building a local terminal message-queue tool called claude-relay discovered that arbitrary user-supplied text containing square brackets caused the entire Textual UI to crash with a MarkupError. Both Textual and the Rich library it builds on treat square brackets as markup tags, so strings like [type='CNAME'] were parsed as malformed styling instructions. An initial fix using Rich's built-in escape() function failed because Textual 8.x uses its own markup parser that does not honour Rich's backslash-escape convention. A secondary crash was traced to the developer's own template code, where a bracketed phrase nested inside a styling tag was misread as an invalid nested tag. The definitive solution was to stop mixing markup and user data entirely, constructing a rich.text.Text object for controlled markup and appending all external content as literal, unparsed text.
This is an AI-generated summary. ShortSingh links to the original source for the complete article.
Discussion (0)
Log in to join the discussion and vote.
Log in