You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Crash when determining link parent in PDF export #7301
bugSomething isn't workingcrashThe Typst compiler crashes for some inputpdfRelated to PDF export or PDF embedding.urgentShould be fixed before the next release.
Would you be able to provide the source code that led to the crash?
Also a note for the future: The issue contains a lot of irrelevant information, which diverts from the point being made. The whole PyO3 thing is unrelated. It's best to keep the issue focused to the problem itself. I edited it now to make it a bit clearer.
Would you be able to provide the source code that led to the crash?
Also a note for the future: The issue contains a lot of irrelevant information, which diverts from the point being made. The whole PyO3 thing is unrelated. It's best to keep the issue focused to the problem itself. I edited it now to make it a bit clearer.
I think I get it now, in order for the FrameItem::Link to be generated within the start and end tags of the LinkMarker, the content of the link marker has to produce a frame (which may then be inlined depending on Frame::should_inline). If for some reason the style applies to the outer frame which already contains the start and end tags, the FrameItem::Link is appended to that frame and thus not inside the tags.
I'm not yet sure, when exactly this happens and how to prevent this but I'll investigate further.
Somewhere during inline::linebreak the linebreak text item "\n" gets removed from between the tags, and an empty text item "" is inserted after the end tags.
bugSomething isn't workingcrashThe Typst compiler crashes for some inputpdfRelated to PDF export or PDF embedding.urgentShould be fixed before the next release.
Activity
laurmaedje commentedon Nov 10, 2025
Would you be able to provide the source code that led to the crash?
Also a note for the future: The issue contains a lot of irrelevant information, which diverts from the point being made. The whole PyO3 thing is unrelated. It's best to keep the issue focused to the problem itself. I edited it now to make it a bit clearer.
[-]pyo3_runtime.PanicException: link parent[/-][+]Crash when determining link parent in PDF export[/+]aersam commentedon Nov 12, 2025
Ok, I was able to create a pretty minimal repo:
saecki commentedon Nov 12, 2025
The problem is that the space which has the
LinkElem::curentstyle applied is extracted from within thelink-markertags:typst/crates/typst-realize/src/lib.rs
Line 834 in bd17979
Pascal-So commentedon Nov 14, 2025
I stumbled across another example of this same panic which I managed to reduce to this snippet:
Note however that the following code works just fine??
Not sure if this is the same underlying issue of if it's a different case. Hope it helps. Tested in typst 0.14.0.
saecki commentedon Nov 24, 2025
This seems to be the same root cause. Since there is no other content inside the link body, the link target is applied to a space element.
laurmaedje commentedon Nov 25, 2025
Here's a spaceless reproduction:
(Should be saved without any trailing whitespace.)
saecki commentedon Nov 25, 2025
I think I get it now, in order for theFrameItem::Linkto be generated within the start and end tags of theLinkMarker, the content of the link marker has to produce a frame (which may then be inlined depending onFrame::should_inline). If for some reason the style applies to the outer frame which already contains the start and end tags, theFrameItem::Linkis appended to that frame and thus not inside the tags.I'm not yet sure, when exactly this happens and how to prevent this but I'll investigate further.
Somewhere during
inline::linebreakthe linebreak text item"\n"gets removed from between the tags, and an empty text item""is inserted after the end tags.