markdown_preview: Fix panic in mermaid diagram renderer#50176
Merged
smitbarmase merged 2 commits intomainfrom Feb 26, 2026
Merged
markdown_preview: Fix panic in mermaid diagram renderer#50176smitbarmase merged 2 commits intomainfrom
smitbarmase merged 2 commits intomainfrom
Conversation
rtfeldman
pushed a commit
that referenced
this pull request
Feb 27, 2026
The mermaid renderer can fail to render certain diagrams, and we already have a fallback for that. It's not worth crashing Zed over it. Wrapping `catch_unwind` alone doesn't work because our panic hooks terminate the process before unwinding begins (we intentionally terminate so the crash handler subprocess can generate a minidump), so there was no way to gracefully handle panics from third-party code until now (in rare cases where we need it, like in this case). To handle this gracefully, we added `crashes::recoverable_panic` which tells the panic hook to stand down on the current thread so the unwind can proceed and be caught. This should be used sparingly since caught panics bypass crash reporting. Release Notes: - Fixed a crash when rendering mermaid diagrams in markdown preview.
tahayvr
pushed a commit
to tahayvr/zed
that referenced
this pull request
Mar 4, 2026
…es#50176) The mermaid renderer can fail to render certain diagrams, and we already have a fallback for that. It's not worth crashing Zed over it. Wrapping `catch_unwind` alone doesn't work because our panic hooks terminate the process before unwinding begins (we intentionally terminate so the crash handler subprocess can generate a minidump), so there was no way to gracefully handle panics from third-party code until now (in rare cases where we need it, like in this case). To handle this gracefully, we added `crashes::recoverable_panic` which tells the panic hook to stand down on the current thread so the unwind can proceed and be caught. This should be used sparingly since caught panics bypass crash reporting. Release Notes: - Fixed a crash when rendering mermaid diagrams in markdown preview.
tahayvr
pushed a commit
to tahayvr/zed
that referenced
this pull request
Mar 4, 2026
…ing panic (zed-industries#50470) zed-industries#50176 added `recoverable_panic` to swallow mermaid panics, then zed-industries#50280 fixed it in upstream. This PR removes the workaround so future panics reach Sentry. Also bumps `mermaid-rs-renderer` to fix a hex parsing panic. Release Notes: - N/A
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The mermaid renderer can fail to render certain diagrams, and we already have a fallback for that. It's not worth crashing Zed over it.
Wrapping
catch_unwindalone doesn't work because our panic hooks terminate the process before unwinding begins (we intentionally terminate so the crash handler subprocess can generate a minidump), so there was no way to gracefully handle panics from third-party code until now (in rare cases where we need it, like in this case).To handle this gracefully, we added
crashes::recoverable_panicwhich tells the panic hook to stand down on the current thread so the unwind can proceed and be caught. This should be used sparingly since caught panics bypass crash reporting.Release Notes: