Skip to content

Failed to convert PDF file: the SVG's nesting depth is too high #6051

@Andrew15-5

Description

@Andrew15-5

Description

To work around #6035, I created a package that should've solved all of my problems and I could just move on. But now apparently my diagram has too much stuff in it (but it's basically a cetz canvas wrapper), and it gives me this error:

error: Failed to convert PDF file: The SVG's nesting depth is too high..

Which happens on this check: https://github.com/typst/svg2pdf/blob/24acb191cfcc3d5b1ca53ea29c42293739c930cd/src/util/helper.rs?plain=1#L60.

Indeed, increasing the number results in svg2pdf not erroring anymore.

The MRE is actually surprisingly simple:

// svg.typ
#show: box
#show: box
#show: box
#show: box
#show: box
#show: box
#show: box
#show: box
#show: box
typst c -f svg svg.typ
// main.typ
#image("svg.svg")
typst c main.typ

@LaurenzV confirmed that it should be considered a bug (and I agree). I use Typst to create an image that is used in a Typst document that should compile without a hitch. Typst + Typst shouldn't give an error.

Cc @johannes-wolf (just so you are aware of such an issue)

Reproduction URL

No response

Operating system

Linux

Typst version

  • I am using the latest version of Typst

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingsvgAnything about the file format for people who like to have fun.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions