Skip to content

internal error: parent group when using placement: auto in figure for some large content #8487

Closed as duplicate

Description

@nik-nul

Description

error: internal error: parent group (occurred at crates/typst-pdf/src/tags/tree/build.rs:202:14)
 = hint: please report this as a bug
Image

Compiling this document under typst 0.14.2 also give the same error message.

If I remove one figure(..., placement: auto) it will give no error message.

Here is the "minimum" reproduction code I could ever found, and every single line is necessary:

#import "@preview/cetz:0.3.4"
#set text(font: ("Libertinus Serif", "Noto Serif CJK SC")) // Noto Serif CJK SC is necessary
#let d = json("./ice.json")
#let f(m) = {
  let a = (m.at(0),)
  for c in m.slice(1) {
    a.push(f(c))
  }
  a
}
#{
  heading(level: 1, "")
  v(140.25pt)
  for s in (
    ("", d.p.e),
    ("", d.p.a),
    ("", d.p.b),
    ("", d.x),
    ("", d.p.c),
    ("", d.p.d),
  ) {
    let (h, c) = s
    heading(level: 2, h)
    c
  }
  heading(level: 2, "")
  figure(cetz.canvas({
    cetz.tree.tree(f(d.t), direction: "right", spread: 1.5, grow: 3.5)
  }), placement: auto)
  heading(level: 2, "")
  for i in d.g {
    heading(level: 2, "")
    [\ *A*]
    let t2 = ()
    for c in i.c {
      t2.push(c.a)
      t2.push(c.b)
      t2.push(c.c)
      t2.push(c.d)
      t2.push(c.e)
    }
    table(
      columns: (auto, auto, auto, auto, auto),
      table.header([一一一一]),
      ..t2,
    )
  }
}

I will upload ice.json later.

Operating system

Linux

Typst version

  • I am using the latest version of Typst

Activity

  1. added
    bug
    on Jun 11, 2026
  2. nik-nul commented on Jun 11, 2026

    @nik-nul
    Author

    Here is the link of ice.json:
    https://box.nju.edu.cn/f/676a925c668843338720/

    Since it is a large file, I don't know the best way to upload it. The link above will be available for at least one year.

    Image
  3. added
    pdf
    on Jun 11, 2026
  4. added
    accessibility
    on Jun 12, 2026
  5. self-assigned this
    on Jun 15, 2026
  6. changed the title [-]internal error: parent group when using `placement: auto` in `figure` for some large content[/-] [+]`internal error: parent group` when using `placement: auto` in `figure` for some large content[/+] on Jul 11, 2026
  7. saecki commented on Jul 20, 2026

    @saecki
    Member

    I've reduced this to the following MRE:

    --- issue-8487-missing-parent-broken-table-with-figure-auto-placment paged ---
    #set page(width: 120pt, height: 95pt, margin: 10pt)
    #rect(height: 20pt)
    #figure(placement: auto, rect(height: 50pt))
    #table(
      columns: 2,
      [A], lorem(2),
      [B], lorem(10),
      [C], lorem(2),
    )

    Which produces the following output:
    Image

    The "B" and "Lorem ipsum" of the second cell is completely missing, which seems like a bug in the grid layouter.

  8. deivisCode commented on Aug 21, 2026

    @deivisCode
    Contributor

    I got a similar internal error: parent group (occurred at crates/typst-pdf/src/tags/tree/build.rs:202:14) while migrating our journal to typst.

    I'm not using any table or figure (like the MRE from Saecki) so hopefully sharing the code here is helpfull. Unfortunately, minimizing the code made the crash so brittle that literally changing a character somewhere fixes it. I'm afraid I cant reduce it significantly more, at this point it was just deleting random lines or swapping some paragraphs to lorem's for 3h to no avail. If there is any tip for cleaning it, Im open to it.

    It also needs an external bibliography, fonts and a custom CSL style (I couldn't get rid of them, sorry) so I just made an orphan branch as a stripped down version of our journal with only one *.typ and the necessary files.

    Im compiling with latest Typst in Ubuntu and Windows 11.

    CODE

    https://github.com/deivisCode/revista/tree/crash

  9. saecki commented on Aug 28, 2026

    @saecki
    Member

    I got a similar internal error: parent group (occurred at crates/typst-pdf/src/tags/tree/build.rs:202:14) while migrating our journal to typst.

    I'm not using any table or figure (like the MRE from Saecki) so hopefully sharing the code here is helpfull. Unfortunately, minimizing the code made the crash so brittle that literally changing a character somewhere fixes it. I'm afraid I cant reduce it significantly more, at this point it was just deleting random lines or swapping some paragraphs to lorem's for 3h to no avail. If there is any tip for cleaning it, Im open to it.

    It also needs an external bibliography, fonts and a custom CSL style (I couldn't get rid of them, sorry) so I just made an orphan branch as a stripped down version of our journal with only one *.typ and the necessary files.

    Im compiling with latest Typst in Ubuntu and Windows 11.

    CODE

    https://github.com/deivisCode/revista/tree/crash

    This actually does seem to be the same problem. The bibliography uses a grid internally and here the last cell seems to be broken across pages, the second image shows part of the URL of the cygnus_x1 citation. But the first part including the cell is missing.

    Image Image
  10. laurmaedje commented on Sep 28, 2026

    @laurmaedje
    Member

    I'll close this in favor of #8890 even though the latter is newer since the latter is more to the point.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

accessibilitybugpdf

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions