quarto-dev / quarto-dev/quarto-cli

Catch errors from `engine: knitr` for logging in Quarto

Open
#12,799 3 comments 1 reaction 1 assignee View on GitHub

@cderv is already working on this.

Since May 21, 2025.

engines-knitr enhancement
Dominant language
JavaScript
Stars
6k
Forks
458
Avg merge
1d 9h
Merged PRs (30d)
41

Description

From:

For engine: julia and engine: jupyter errors are caught by Quarto allowing the use of the --log* flags to see them.

TL;DR:

  • julia has only the Julia error in the log
  • Jupyter/Python has the Jupyter/Python error and ERROR: [non-error-thrown] undefined in the log
  • knitr/R has only ERROR: [non-error-thrown] undefined in the log
quarto render index.qmd --log-level error --log test.log --log-format json-stream
---
format: html
engine: julia
---

```{julia}
variable + asdfga
```
{"msg":"Julia server returned error after receiving \"run\" command:\n\nFailed to run notebook: /Users/mcanouil/Projects/quarto-dev/quarto-playground/index.qmd\n\nThe underlying Julia error was:\n\nEvaluationError: Encountered 1 error during evaluation\n\nError 1 of 1\n@ /Users/mcanouil/Projects/quarto-dev/quarto-playground/index.qmd:6\nUndefVarError: `variable` not defined in `Main.Notebook`\nSuggestion: check for spelling errors or missing imports.\nStacktrace:\n [1] top-level scope\n\u001b[90m   @\u001b[39m \u001b[90m~/Projects/quarto-dev/quarto-playground/\u001b[39m\u001b[90m\u001b[4mindex.qmd:7\u001b[24m\u001b[39m\n\n\nStack trace:\n    at writeJuliaCommand (file:///Users/mcanouil/Projects/quarto-dev/quarto-cli/src/execute/julia.ts:790:13)\n    at eventLoopTick (ext:core/01_core.js:178:7)\n    at async executeJulia (file:///Users/mcanouil/Projects/quarto-dev/quarto-cli/src/execute/julia.ts:603:20)\n    at async Object.execute (file:///Users/mcanouil/Projects/quarto-dev/quarto-cli/src/execute/julia.ts:154:16)\n    at async renderExecute (file:///Users/mcanouil/Projects/quarto-dev/quarto-cli/src/command/render/render-files.ts:234:25)\n    at async renderFileInternal (file:///Users/mcanouil/Projects/quarto-dev/quarto-cli/src/command/render/render-files.ts:602:35)\n    at async renderFiles (file:///Users/mcanouil/Projects/quarto-dev/quarto-cli/src/command/render/render-files.ts:327:9)\n    at async render (file:///Users/mcanouil/Projects/quarto-dev/quarto-cli/src/command/render/render-shared.ts:104:18)\n    at async Command.actionHandler (file:///Users/mcanouil/Projects/quarto-dev/quarto-cli/src/command/render/cmd.ts:251:26)\n    at async Command.execute (https://deno.land/x/cliffy@v1.0.0-rc.3/command/command.ts:1948:7)","level":40,"levelName":"ERROR","loggerName":"default"}
---
format: html
engine: jupyter
---

```{python}
variable + asdfga
```
{"msg":"\n\nAn error occurred while executing the following cell:\n------------------\nvariable + asdfga\n------------------\n\n\n\u001b[31m---------------------------------------------------------------------------\u001b[39m\n\u001b[31mNameError\u001b[39m                                 Traceback (most recent call last)\n\u001b[36mCell\u001b[39m\u001b[36m \u001b[39m\u001b[32mIn[2]\u001b[39m\u001b[32m, line 1\u001b[39m\n\u001b[32m----> \u001b[39m\u001b[32m1\u001b[39m \u001b[43mvariable\u001b[49m + asdfga\n\n\u001b[31mNameError\u001b[39m: name 'variable' is not defined\n","level":40,"levelName":"ERROR","loggerName":"default"}

{"msg":"[non-error-thrown] undefined\n\nStack trace:\n    at Command.handleError (https://deno.land/x/cliffy@v1.0.0-rc.3/command/command.ts:2202:11)\n    at Command.parseCommand (https://deno.land/x/cliffy@v1.0.0-rc.3/command/command.ts:1782:12)\n    at eventLoopTick (ext:core/01_core.js:178:7)\n    at async quarto (file:///Users/mcanouil/Projects/quarto-dev/quarto-cli/src/quarto.ts:193:5)\n    at async file:///Users/mcanouil/Projects/quarto-dev/quarto-cli/src/quarto.ts:225:5\n    at async file:///Users/mcanouil/Projects/quarto-dev/quarto-cli/src/core/main.ts:45:14\n    at async mainRunner (file:///Users/mcanouil/Projects/quarto-dev/quarto-cli/src/core/main.ts:47:5)\n    at async file:///Users/mcanouil/Projects/quarto-dev/quarto-cli/src/quarto.ts:215:3","level":40,"levelName":"ERROR","loggerName":"default"}
---
format: html
engine: knitr
---

```{r}
variable + asdfga
```
{"msg":"[non-error-thrown] undefined\n\nStack trace:\n    at Command.handleError (https://deno.land/x/cliffy@v1.0.0-rc.3/command/command.ts:2202:11)\n    at Command.parseCommand (https://deno.land/x/cliffy@v1.0.0-rc.3/command/command.ts:1782:12)\n    at eventLoopTick (ext:core/01_core.js:178:7)\n    at async quarto (file:///Users/mcanouil/Projects/quarto-dev/quarto-cli/src/quarto.ts:193:5)\n    at async file:///Users/mcanouil/Projects/quarto-dev/quarto-cli/src/quarto.ts:225:5\n    at async file:///Users/mcanouil/Projects/quarto-dev/quarto-cli/src/core/main.ts:45:14\n    at async mainRunner (file:///Users/mcanouil/Projects/quarto-dev/quarto-cli/src/core/main.ts:47:5)\n    at async file:///Users/mcanouil/Projects/quarto-dev/quarto-cli/src/quarto.ts:215:3","level":40,"levelName":"ERROR","loggerName":"default"}

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.