quarto-dev / quarto-dev/quarto-cli
Exception when writing pdf to stdout with output-dir specified in _quarto.yml
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 6k
- Forks
- 458
- Avg merge
- 1d 9h
- Merged PRs (30d)
- 41
Description
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
I tend to specify an output directory in my _quarto.yml file so that the generated files don't clutter up my project directory during project development.
When I use the same project in an automated environment where I use the Quarto CLI to write different formats to standard output, the file is written correctly, but for the PDF format, the Quarto process causes an exception during cleanup and exits with exit code 1.
I can work around this (as I said, the output file is written correctly), but it's annoying and probably not intended, so I'm reporting it here.
I have reproduced it on Ubuntu (Noble) with Quarto 1.7.34 and on Windows 11 with Quarto 1.8.24.
Steps to reproduce
To reproduce the problem you need a very basic Quarto file and a _quarto.yml file that sets output-dir, like the following.
Quarto file (I've named it repro.qmd).
---
title: "Repro"
---
Not much needed
Quarto project metadata file (_quarto.yml) in the same directory.
project:
output-dir: _output
Create a pdf file from it using the following command.
quarto render repro.qmd --log-level error --to pdf --output - > output.pdf
Actual behavior
The file is created properly but the quarto process will exit with exit code 1 and write something like the following exception to stderr (this is quarto 1.7.34 on Ubuntu but 1.8.24 on Windows is basically the same with different paths):
ERROR: NotFound: No such file or directory (os error 2): rename '/tmp/quarto_report_4S4MBB/-' -> '/tmp/quarto_report_4S4MBB/_output/-'
Stack trace:
at Object.renameSync (ext:deno_fs/30_fs.js:267:3)
at safeMoveSync (file:///opt/quarto/1.7.34/bin/quarto.js:2354:14)
at renderProject (file:///opt/quarto/1.7.34/bin/quarto.js:87372:17)
at eventLoopTick (ext:core/01_core.js:175:7)
at async Command.actionHandler (file:///opt/quarto/1.7.34/bin/quarto.js:91975:32)
at async Command.execute (file:///opt/quarto/1.7.34/bin/quarto.js:8253:13)
at async Command.parseCommand (file:///opt/quarto/1.7.34/bin/quarto.js:8143:20)
at async quarto (file:///opt/quarto/1.7.34/bin/quarto.js:133948:9)
at async file:///opt/quarto/1.7.34/bin/quarto.js:133978:9
at async file:///opt/quarto/1.7.34/bin/quarto.js:133830:20
Expected behavior
The quarto process should exit with exit code 0 and shouldn't generate any exception.
Your environment
- OS: Microsoft Windows [Version 10.0.26100.6584]
- Shell: PowerShell 7.5.3
and
- OS: Ubuntu 24.04.3 LTS
- Shell: Bash 5.2.21(1)-release
Quarto check output
Ubuntu (Noble):
quarto check
Quarto 1.7.34
[✓] Checking environment information...
Quarto cache location: /home/app/.cache/quarto
[✓] Checking versions of quarto binary dependencies...
Pandoc version 3.6.3: OK
Dart Sass version 1.85.1: OK
Deno version 1.46.3: OK
Typst version 0.13.0: OK
[✓] Checking versions of quarto dependencies......OK
[✓] Checking Quarto installation......OK
Version: 1.7.34
Path: /opt/quarto/1.7.34/bin
[✓] Checking tools....................OK
TinyTeX: (external install)
Chromium: (not installed)
[✓] Checking LaTeX....................OK
Using: TinyTex
Path: /home/app/.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.1
Path: /usr/lib/R
LibPaths:
- /usr/local/lib/R/site-library
- /usr/lib/R/site-library
- /usr/lib/R/library
knitr: 1.50
rmarkdown: 2.29
[✓] Checking Knitr engine render......OK
Windows 11:
quarto check
Quarto 1.8.24
[>] Checking environment information...
Quarto cache location: C:\Users\brar\AppData\Local\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.24
Path: C:\Program Files\Quarto\bin
CodePage: 1252
[>] Checking tools....................OK
TinyTeX: (not installed)
Chromium: (not installed)
[>] Checking LaTeX....................OK
Tex: (not detected)
[>] Checking Chrome Headless....................OK
Using: Chrome found on system
Path: C:\Program Files (x86)\Microsoft\Edge\Application\msedge.exe
Source: Windows Registry
[>] Checking basic markdown render....OK
[>] Checking Python 3 installation....(None)
Unable to locate an installed version of Python 3.
Install Python 3 from https://www.python.org/downloads/
[>] Checking R installation...........OK
Version: 4.5.1
Path: C:/PROGRA~1/R/R-45~1.1
LibPaths:
- C:/Users/brar/AppData/Local/R/win-library/4.5
- C:/Program Files/R/R-4.5.1/library
knitr: 1.50
rmarkdown: 2.29
[>] Checking Knitr engine render......OK
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the failure with repro.qmd, _quarto.yml, and the quarto render repro.qmd --log-level error --to pdf --output - > output.pdf command. Start with the renderProject and safeMoveSync entries shown in the stack trace, then verify that PDF output to stdout with output-dir exits with code 0 without the rename exception.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- cli
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 45/100