Skip to content

Parameters and jupyter engine crashes when label is set #10097

@mcanouil

Description

@mcanouil

See the following simple code.
It appears the parameters code cell is duplicated when passing a new value for the parameter via the commande line.
Unfortunately, if the code cell initialising the parameters has a label it leads to a duplicate label error.

Tested on main (~1.5.46)

---
format: html
engine: jupyter
---

```{python}
#| label: test
#| tags: [parameters]
datapath = None
```

Trigger the crash by sending a new parameter value

quarto render index.qmd --execute-param datapath:"weird" --execute
Executing 'index.quarto_ipynb'
  Cell 1/2: 'test'...Done
  Cell 2/2: 'test'...Done

ERROR: Cell label names must be unique (found duplicate '#test')

Stack trace:
    at file:///Users/mcanouil/Projects/quarto/quarto-cli/src/core/jupyter/labels.ts:53:15
    at jupyterToMarkdown (file:///Users/mcanouil/Projects/quarto/quarto-cli/src/core/jupyter/jupyter.ts:758:5)
    at eventLoopTick (ext:core/01_core.js:153:7)
    at async Object.execute (file:///Users/mcanouil/Projects/quarto/quarto-cli/src/execute/jupyter/jupyter.ts:378:20)
    at async renderExecute (file:///Users/mcanouil/Projects/quarto/quarto-cli/src/command/render/render-files.ts:232:25)
    at async renderFileInternal (file:///Users/mcanouil/Projects/quarto/quarto-cli/src/command/render/render-files.ts:592:35)
    at async renderFiles (file:///Users/mcanouil/Projects/quarto/quarto-cli/src/command/render/render-files.ts:325:9)
    at async render (file:///Users/mcanouil/Projects/quarto/quarto-cli/src/command/render/render-shared.ts:102:18)
    at async Command.actionHandler (file:///Users/mcanouil/Projects/quarto/quarto-cli/src/command/render/cmd.ts:248:26)
    at async Command.execute (file:///Users/mcanouil/Projects/quarto/quarto-cli/src/vendor/deno.land/x/cliffy@v1.0.0-rc.3/command/command.ts:1948:7)

Keeping the default parameter value

quarto render index.qmd --execute
Executing 'index.quarto_ipynb'
  Cell 1/1: 'test'...Done

pandoc 
  to: html
  output-file: index.html
  standalone: true
  section-divs: true
  html-math-method: mathjax
  wrap: none
  default-image-extension: png
  
metadata
  document-css: false
  link-citations: true
  date-format: long
  lang: en
  
Output created: index.html

Originally posted by @mcanouil in #10081 (reply in thread)

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingengines-jupyterAnything related to Jupyter engineparameters

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions