Skip to content

linux: compilation to pdf fails if document contains mermaid block #14082

Closed as duplicate

Description

@Gewerd-Strauss

I have:

  • searched the issue tracker for similar issues
  • installed the latest version of Quarto CLI
  • formatted my issue following the Bug Reports guide

Bug description

Hello,

I am experiencing an issue related to mermaid-blocks. Compilation to pdf fails for the following document under linux specifically:

---
title: "failure document"
author: Gewerd-Strauss
format:
  html: default
   pdf: default
---


```{mermaid}
%%| fig-width: 1.5
%%| fig-height: 1.5
%%| fig-dpi: 700
flowchart LR
    A([Start]) --> B{Boolean Condition}
    B -->|Yes| C[[unterprogram]]
    B -->|No| D[subblockB]
    C --> E[/"Ein/Ausgabe"/]
    D --> E[/"Ein/Ausgabe"/]
    E --> F([End])
```


This file will refuse to compile to pdf; as it contains the above mermaid-block.
Adding the render-target `pdf` as declared above yields this log/error: 
[excluded for brevity]

compiling the above with pdf-target enabled yields

gewerd-strauss@gewerdstrauss-B650E-AORUS-PRO-X-USB4:/media/gewerd-strauss/data/Repositories/quarto/quarto-issue-cannot-find-svg-elem$ quarto render tests/failure.qmd --to pdf
ERROR: Internal Error: Couldn't find an svg element in svg string

This is a bug in quarto. We apologize for the inconvenience.
Please consider reporting it at https://github.com/quarto-dev/quarto-cli. Thank you!

Stack trace:
    at resolveSize (file:///opt/quarto/bin/quarto.js:120856:11)
    at eventLoopTick (ext:core/01_core.js:178:7)
    at async makePng (file:///opt/quarto/bin/quarto.js:121255:11)
    at async makeDefault (file:///opt/quarto/bin/quarto.js:121321:16)
    at async Object.cell (file:///opt/quarto/bin/quarto.js:121354:14)
    at async Promise.all (index 0)
    at async Object.document (file:///opt/quarto/bin/quarto.js:70839:21)
    at async handleLanguageCells (file:///opt/quarto/bin/quarto.js:70804:34)
    at async file:///opt/quarto/bin/quarto.js:125072:41
    at async withTimingAsync (file:///opt/quarto/bin/quarto.js:20124:21)
gewerd-strauss@gewerdstrauss-B650E-AORUS-PRO-X-USB4:/media/gewerd-strauss/data/Repositories/quarto/quarto-issue-cannot-find-svg-elem$

I hope this helps.

I am happy to provide further info if needed; but I am currently in the middle of my university's examination phase; I might not respond immediately.

Thank you.
~Gw

Steps to reproduce

This issue also occures under linux when rendering the aforementioned failure.qmd to pdf as a standalone document outside of a project structure. Given that this issue does not occur under windows for me, I have opted for a slightly more expanded reprex; which exists under this repo.

The reprex' structure:

  • scripts/qc.sh pipes the output of quarto check all into a platform-dependent txt-files, found under /res/.
    On linux, it also pipes thej result of which rsvg-convert to a similar file. As they are piped this way, the structure and markup of the logs are a bit cursed; particularly the [ checkmark] Checking XXX-lines are missing from the output; which makes it somewhat hard to see what tool a given set of information actually belongs to1.
  • index.qmd holds environment and render information (within include meta/_compile-info_v2.qmd)
    • The generated _site/index.html specifically reflects the compilation-state under linux. It also contains the contents of the txt-files generated by qc.sh. This structure is mostly to allow caching environment state between two machines on my end.
  • tests/failure.qmd: Document containing a mermaid block. By default (as-is-in-current-commit); this only compiles to html. To compile to pdf, uncomment line 6 and recompile via quarto.
  • renv.lock: similarly, this holds the R state of the linux-machine. However note that this only pertains to the workings of the R-code querying stuff for the upper part of index.qmd; the offending document itself does not leverage R at all.
  • windows_compiled_target: contains the html- and pdf-output docs generated under windows. Necessary as compilation under linux would otherwhise simply overwrite them.

Notes that while the versions printed within the repo state version 1.8.26; during the process of writing this up I have upgraded to 1.8.27 on linux; and the issue remains.
Additionally, I have tested under current pre-release 1.9.23; which returned the same error; but with a slightly larger stacktrace:

gewerd-strauss@gewerdstrauss-B650E-AORUS-PRO-X-USB4:/media/gewerd-strauss/data/Repositories/quarto/quarto-issue-cannot-find-svg-elem$ quarto render tests/failure.qmd --to pdf
ERROR: Internal Error: Couldn't find an svg element in svg string

This is a bug in quarto. We apologize for the inconvenience.
Please consider reporting it at https://github.com/quarto-dev/quarto-cli. Thank you!

Stack trace:
    at resolveSize (file:///opt/quarto/bin/quarto.js:131654:11)
    at eventLoopTick (ext:core/01_core.js:179:7)
    at async makePng (file:///opt/quarto/bin/quarto.js:132065:11)
    at async makeDefault (file:///opt/quarto/bin/quarto.js:132131:16)
    at async Object.cell (file:///opt/quarto/bin/quarto.js:132164:14)
    at async Promise.all (index 0)
    at async Object.document (file:///opt/quarto/bin/quarto.js:69028:25)
    at async handleLanguageCells (file:///opt/quarto/bin/quarto.js:68828:34)
    at async file:///opt/quarto/bin/quarto.js:136609:41
    at async withTimingAsync (file:///opt/quarto/bin/quarto.js:15978:21)
    at async renderFileInternal (file:///opt/quarto/bin/quarto.js:136608:9)
    at async renderFiles (file:///opt/quarto/bin/quarto.js:136374:9)
    at async renderProject (file:///opt/quarto/bin/quarto.js:136943:23)
    at async _Command.actionHandler (file:///opt/quarto/bin/quarto.js:142274:24)
    at async _Command.execute (file:///opt/quarto/bin/quarto.js:101925:7)
    at async _Command.parseCommand (file:///opt/quarto/bin/quarto.js:101802:14)
    at async quarto4 (file:///opt/quarto/bin/quarto.js:187302:5)
    at async file:///opt/quarto/bin/quarto.js:187330:5
    at async file:///opt/quarto/bin/quarto.js:187185:14
    at async mainRunner (file:///opt/quarto/bin/quarto.js:187187:5)
gewerd-strauss@gewerdstrauss-B650E-AORUS-PRO-X-USB4:/media/gewerd-strauss/data/Repositories/quarto/quarto-issue-cannot-find-svg-elem$

Actual behavior

Document tests/failure.qmd fails compilation to pdf under linux with aforementioned error.

Expected behavior

It should compile.

Your environment

System:  
  Kernel: 6.14.0-37-generic arch: x86_64 bits: 64 compiler: gcc v: 13.3.0 clocksource: tsc  
  Desktop: Cinnamon v: 6.4.8 tk: GTK v: 3.24.41 wm: Muffin v: 6.4.1 vt: 7 dm: LightDM v: 1.30.0  
  Distro: Linux Mint 22.2 Zara base: Ubuntu 24.04 noble, x11  

Quarto-versions explicitly checked:

System, quarto-version PDF compiles
*Windows; 1.8.24 Yes
*Linux; 1.8.26 No
Linux; 1.8.27 No
Linux; 1.9.23 No

* Versions present in reprex-repo.

Quarto check output

gewerd-strauss@gewerdstrauss-B650E-AORUS-PRO-X-USB4:~$ quarto check
Quarto 1.8.27
[✓] Checking environment information...
      Quarto cache location: /home/gewerd-strauss/.cache/quarto
[✓] Checking versions of quarto binary dependencies...
      Pandoc version 3.6.3: OK
      Dart Sass version 1.87.0: OK
      Deno version 2.3.1: OK
      Typst version 0.13.0: OK
[✓] Checking versions of quarto dependencies......OK
[✓] Checking Quarto installation......OK
      Version: 1.8.27
      Path: /opt/quarto/bin

[✓] Checking tools....................OK
      TinyTeX: v2026.01
      Chromium: 869685

[✓] Checking LaTeX....................OK
      Using: TinyTex
      Path: /home/gewerd-strauss/.TinyTeX/bin/x86_64-linux
      Version: 2025

[✓] Checking Chrome Headless....................OK
      Chrome:  (not detected)

[✓] Checking basic markdown render....OK

[✓] Checking Python 3 installation....OK
      Version: 3.12.3
      Path: /usr/bin/python3
      Jupyter: (None)

      Jupyter is not available in this Python installation.
      Install with python3 -m pip install jupyter

[✓] Checking R installation...........OK
      Version: 4.5.2
      Path: /usr/lib/R
      LibPaths:
        - /home/gewerd-strauss/R/x86_64-pc-linux-gnu-library/4.5
        - /usr/local/lib/R/site-library
        - /usr/lib/R/site-library
        - /usr/lib/R/library
      knitr: 1.51
      rmarkdown: 2.30

[✓] Checking Knitr engine render......OK

Footnotes

  1. Sidenote; Might it be sensible to create a flag that holds back the entire output of quarto check until it obtained all info; and then dumps as a single string? That should hypothetically resolve this issue; and make piping this info to other processi/documents/... easier. That's just a rough thought, maybe I am overlooking something here. ↩

Activity

  1. added
    bug
    on Feb 21, 2026
  2. mcanouil commented on Feb 21, 2026

    @mcanouil
    Collaborator

    have you looked at all the previous discussions/issues about this exact error?

    Also your LaTeX installation looks weird or at least what Quarto sees:

    [✓] Checking tools....................OK
          TinyTeX: v2026.01
          Chromium: 869685
    
    [✓] Checking LaTeX....................OK
          Using: TinyTex
          Path: /home/gewerd-strauss/.TinyTeX/bin/x86_64-linux
          Version: 2025
  3. added
    duplicate
    and removed
    bug
    on Feb 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    duplicate

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions