Skip to content

Errors with multiline strings are printed incorrectly #12270

Closed
@jkrumbiegel

Description

@jkrumbiegel

Bug description

I noticed that error messages I throw from the julia engine code sometimes contain repeated sections, this seems to happen when the error message is a multiline string. For some reason lines 2:end are spliced into the stack trace. It looks like this, notice the repeated lines after Stack trace::

ERROR: Julia server returned error after receiving "close" command:

Failed to close notebook: /Users/krumbiegel/.julia/dev/QuartoNotebookRunner/scratch/test.qmd

The underlying Julia error was:

Tried to close file "/Users/krumbiegel/.julia/dev/QuartoNotebookRunner/scratch/test.qmd" but the corresponding worker is busy.

Stack trace:

Failed to close notebook: /Users/krumbiegel/.julia/dev/QuartoNotebookRunner/scratch/test.qmd

The underlying Julia error was:

Tried to close file "/Users/krumbiegel/.julia/dev/QuartoNotebookRunner/scratch/test.qmd" but the corresponding worker is busy.
    at writeJuliaCommand (file:///Users/krumbiegel/dev/quarto-cli/src/execute/julia.ts:791:13)
    at eventLoopTick (ext:core/01_core.js:175:7)
    at async connectAndWriteJuliaCommandToRunningServer (file:///Users/krumbiegel/dev/quarto-cli/src/execute/julia.ts:958:20)
    at async closeWorker (file:///Users/krumbiegel/dev/quarto-cli/src/execute/julia.ts:975:3)
    at async Command.actionHandler (file:///Users/krumbiegel/dev/quarto-cli/src/execute/julia.ts:876:7)
    at async Command.execute (https://deno.land/x/[email protected]/command/command.ts:1948:7)
    at async Command.parseCommand (https://deno.land/x/[email protected]/command/command.ts:1780:14)
    at async quarto (file:///Users/krumbiegel/dev/quarto-cli/src/quarto.ts:191:5)
    at async file:///Users/krumbiegel/dev/quarto-cli/src/quarto.ts:220:5
    at async file:///Users/krumbiegel/dev/quarto-cli/src/core/main.ts:41:14

I guess it's this code that does the splicing https://github.com/PumasAI/quarto-cli/blob/d109025e0bd34c0dfeb23780669c361e7c561016/src/core/log.ts#L347-L349 but I'm not sure why part of the message is considered the stack in the first place.

Steps to reproduce

No response

Actual behavior

No response

Expected behavior

No response

Your environment

No response

Quarto check output

% quarto check
Check file:///Users/krumbiegel/dev/quarto-cli/src/quarto.ts
Quarto 99.9.9
[✓] Checking environment information...
      Quarto cache location: /Users/krumbiegel/Library/Caches/quarto
[✓] Checking versions of quarto binary dependencies...
      Pandoc version 3.4.0: OK
      Dart Sass version 1.70.0: OK
      Deno version 1.46.3: OK
      Typst version 0.11.0: OK
[✓] Checking versions of quarto dependencies......OK
[✓] Checking Quarto installation......OK
      Version: 99.9.9
      commit: b41d51371a167411c8a6938f86d850e1e66e3108
      Path: /Users/krumbiegel/dev/quarto-cli/package/dist/bin

[✓] Checking tools....................OK
      TinyTeX: v2025.01
      Chromium: (not installed)

[✓] Checking LaTeX....................OK
      Using: TinyTex
      Path: /Users/krumbiegel/Library/TinyTeX/bin/universal-darwin
      Version: 2024

[✓] Checking Chrome Headless....................OK
      Using: Chrome found on system
      Path: /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
      Source: MacOS known location

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

[✓] Checking Python 3 installation....OK
      Version: 3.12.2 (Conda)
      Path: /Users/krumbiegel/miniconda3/bin/python
      Jupyter: 5.5.0
      Kernels: julia-1.11, julia-1.10, julia-1.8, julia-1.7, python3

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

[✓] Checking R installation...........OK
      Version: 4.3.2
      Path: /Library/Frameworks/R.framework/Resources
      LibPaths:
        - /Users/krumbiegel/dev/quarto-cli/tests/renv/library/R-4.3/aarch64-apple-darwin20
        - /Users/krumbiegel/Library/Caches/org.R-project.R/R/renv/sandbox/R-4.3/aarch64-apple-darwin20/ac5c2659
      knitr: 1.49.8
      rmarkdown: 2.29.1

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

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingjuliatriaged-toIssues that were not self-assigned, signals that an issue was assigned to someone.

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions