Something went wrong. - resolveLanguage: "txt" not found in bundled or custom languages #210
maria-rcks added labelsbug
t3dotgg(GitHub profile, opens in a new tab) closed this
Sign in to join this conversation.
maria-rcks added labelsbug
t3dotgg(GitHub profile, opens in a new tab) closed this
Sign in to join this conversation.
As probably not allowed to push and create a PR lets go this way.
I tracked this down and the crash is caused by markdown code fences using
txtas the language.Problem If a chat message contains a fenced code block like:
the renderer extracts
txtfrom the markdown fence and passes it directly into the Shiki highlighter. In the current implementation, that value is not normalized and there is no safe fallback for unsupported language ids.That leads to this runtime error:
resolveLanguage: "txt" not found in bundled or custom languagesand the chat view / renderer crashes.
Why this happens
In
apps/web/src/components/ChatMarkdown.tsx, the code fence language is taken from the markdown class name and used directly in the highlight path (getSharedHighlighter(...)/codeToHtml(...)).This is unsafe because markdown content may contain aliases or unsupported language ids.
txtis a common fence label, but this highlighter setup does not accept it as-is.Why this also affects the desktop release
This is in the shared React chat renderer, so the packaged desktop app is affected too. I hit this in the Windows installer release (
v0.0.2), and the same issue is present in thev0.0.2source tag as well.Suggested fix
Suggested alias handling:
txt->textplain->textplaintext->texttextRecommended behavior:
textExpected result
```txtblocks no longer crash the apptxt/ plain-text aliases