Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"attempt to index a nil value (field 'caption_long')" error thrown when trying to preview a page with both a lightbox image and an embedded scanpy figure #10196

Closed
nickvigilante opened this issue Jul 2, 2024 · 5 comments · Fixed by #10198
Assignees
Labels
bug Something isn't working
Milestone

Comments

@nickvigilante
Copy link

Bug description

We have a documentation page that has both images using the standard Quarto syntax with the .lightbox class and an embedded Jupyter notebook cell containing a scanpy plot. In 1.4.557, Quarto was able to handle both at the same time. In 1.5.52, we now face an error.

If I disable the .lightbox class on all images on the page, it builds successfully. Also, if I delete the embed cell pointing to the scanpy plot, it builds successfully. The presence of both causes an error.

I've instructed my team not to use 1.5.52 until this issue is resolved, and the steps to downgrade are simple enough. This is also reproducible on 1.6.0.

Steps to reproduce

Using Quarto 1.5.52:

git clone https://github.com/nickvigilante/index-nil-value-caption-long-lightbox-bug
cd index-nil-value-caption-long-lightbox-bug
conda env create -f environment.yml
conda activate index-nil-value-caption-long-lightbox-bug
quarto preview

Expected behavior

The page renders correctly and shows both a royalty-free lightbox image of a cat and a scanpy scatter plot.

Actual behavior

The following error is thrown:

Error running filter /Applications/quarto/share/filters/main.lua:
/Applications/quarto/share/filters/main.lua:11765: attempt to index a nil value (field 'caption_long')
stack traceback:
        [C]: in ?
        [C]: in method 'walk'
        /Applications/quarto/share/filters/main.lua:557: in function </Applications/quarto/share/filters/main.lua:546>
        (...tail calls...)
        /Applications/quarto/share/filters/main.lua:11762: in local 'filter_fn'
        /Applications/quarto/share/filters/main.lua:635: in function </Applications/quarto/share/filters/main.lua:625>
        (...tail calls...)
        [C]: in ?
        [C]: in method 'walk'
        /Applications/quarto/share/filters/main.lua:557: in function </Applications/quarto/share/filters/main.lua:546>
        (...tail calls...)
        /Applications/quarto/share/filters/main.lua:1334: in local 'callback'
        /Applications/quarto/share/filters/main.lua:1352: in upvalue 'run_emulated_filter_chain'
        /Applications/quarto/share/filters/main.lua:1388: in function </Applications/quarto/share/filters/main.lua:1385>
stack traceback:
        /Applications/quarto/share/filters/main.lua:557: in function </Applications/quarto/share/filters/main.lua:546>
        (...tail calls...)
        /Applications/quarto/share/filters/main.lua:11762: in local 'filter_fn'
        /Applications/quarto/share/filters/main.lua:635: in function </Applications/quarto/share/filters/main.lua:625>
        (...tail calls...)
        [C]: in ?
        [C]: in method 'walk'
        /Applications/quarto/share/filters/main.lua:557: in function </Applications/quarto/share/filters/main.lua:546>
        (...tail calls...)
        /Applications/quarto/share/filters/main.lua:1334: in local 'callback'
        /Applications/quarto/share/filters/main.lua:1352: in upvalue 'run_emulated_filter_chain'
        /Applications/quarto/share/filters/main.lua:1388: in function </Applications/quarto/share/filters/main.lua:1385>
stack traceback:
        /Applications/quarto/share/filters/main.lua:557: in function </Applications/quarto/share/filters/main.lua:546>
        (...tail calls...)
        /Applications/quarto/share/filters/main.lua:1334: in local 'callback'
        /Applications/quarto/share/filters/main.lua:1352: in upvalue 'run_emulated_filter_chain'
        /Applications/quarto/share/filters/main.lua:1388: in function </Applications/quarto/share/filters/main.lua:1385>

Your environment

  • OS: Sonoma 14.5 (Apple M3 Pro)

Quarto check output

Quarto 1.5.52
[✓] Checking versions of quarto binary dependencies...
Pandoc version 3.2.0: OK
Dart Sass version 1.70.0: OK
Deno version 1.41.0: OK
Typst version 0.11.0: OK
[✓] Checking versions of quarto dependencies......OK
[✓] Checking Quarto installation......OK
Version: 1.5.52
Path: /Applications/quarto/bin

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

[✓] Checking LaTeX....................OK
Tex: (not detected)

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

[✓] Checking Python 3 installation....OK
Version: 3.12.4 (Conda)
Path: /Users/nickv/miniforge3/envs/index-nil-value-caption-long-lightbox-bug/bin/python
Jupyter: 5.7.2
Kernels: ir, python3

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

[✓] Checking R installation...........OK
Version: 4.4.1
Path: /opt/homebrew/Cellar/r/4.4.1/lib/R
LibPaths:
- /opt/homebrew/lib/R/4.4/site-library
- /opt/homebrew/Cellar/r/4.4.1/lib/R/library
knitr: 1.47
rmarkdown: 2.27

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

@nickvigilante nickvigilante added the bug Something isn't working label Jul 2, 2024
@cscheid
Copy link
Collaborator

cscheid commented Jul 2, 2024

Thanks for the report. Is it ok if we use your repo as a regression test?

@cscheid cscheid added this to the Hot-fix milestone Jul 2, 2024
@cscheid cscheid self-assigned this Jul 2, 2024
@nickvigilante
Copy link
Author

Yes, absolutely. I just added the MIT license to the repo.

@cscheid
Copy link
Collaborator

cscheid commented Jul 2, 2024

Ok. I have a fix already, PR coming up soon.

@nickvigilante
Copy link
Author

Sounds good! No rush, because I'm testing this across our entire repo, so I want to see if there are others that fail for a similar reason.

@cscheid
Copy link
Collaborator

cscheid commented Jul 2, 2024

Just for the record, this is a downstream consequence of the Pandoc fix that changed how accessing some pandoc AST nodes would cause Plain [] to be inserted, so some of the code we have that would work is now finding nil instead.

(our internal record)

ns-rse added a commit to ns-rse/sheffield-thyroid that referenced this issue Jul 11, 2024
Closes #28

**IMPORTANT** Currently there is a [bug in the stable release of
Quarto](quarto-dev/quarto-cli#10196) which prevents rendering of the missing data figures. It
is fixed in development version [`v1.6.1`](https://github.com/quarto-dev/quarto-cli/releases/tag/v1.6.1) (currently
available as pre-release, so if things don't render upgrade to this version).

+ Uses the [mice](https://amices.org/mice/index.html) package to summarise missing data graphically and undertake three
  different methods of multiple imputation. Functions are defined to aid with the plotting of imputed data for
  comparison to the original dataset. Notes on tasks that could be done to augment this such as tabulation.
  This is via the `sections/_interpolation.qmd` file. Includes citation for the mice R package.
+ Moves data dictionary to Appendix.
+ Tidies up tables adding missing captions and removing `print()`
+ Moves tables to [panel-tabset](https://quarto.org/docs/interactive/layout.html#tabset-panel) as document was getting
  long and cluttered. This makes it shorter and easier to navigate. Used for plots that summarise imputation.
+ Introduces caching to the document so that computationally expensive sections of code are not re-run on every render.
+ Some house keeping wrapping lines to 120 characters.
+ Moves summary of missing data patterns to `sections/_missing.qmd`.
+ Removes `dark_theme_minimal()` from plot of final lasso.
+ Tidies up `sections/_logistic.qmd` to explicitly use `family = binomial(link = "logit")` (**NB** Previous work ensured
  the `train` data frame is used in all logistic regression rather the raw `df` which includes individuals with missing
  `final_pathology`).
ns-rse added a commit to ns-rse/sheffield-thyroid that referenced this issue Jul 11, 2024
Closes #28

**IMPORTANT** Currently there is a [bug in the stable release of
Quarto](quarto-dev/quarto-cli#10196) which prevents rendering of the missing data figures. It
is fixed in development version [`v1.6.1`](https://github.com/quarto-dev/quarto-cli/releases/tag/v1.6.1) (currently
available as pre-release, so if things don't render upgrade to this version).

+ Uses the [mice](https://amices.org/mice/index.html) package to summarise missing data graphically and undertake three
  different methods of multiple imputation. Functions are defined to aid with the plotting of imputed data for
  comparison to the original dataset. Notes on tasks that could be done to augment this such as tabulation.
  This is via the `sections/_interpolation.qmd` file. Includes citation for the mice R package.
+ Moves data dictionary to Appendix.
+ Tidies up tables adding missing captions and removing `print()`
+ Moves tables to [panel-tabset](https://quarto.org/docs/interactive/layout.html#tabset-panel) as document was getting
  long and cluttered. This makes it shorter and easier to navigate. Used for plots that summarise imputation.
+ Introduces caching to the document so that computationally expensive sections of code are not re-run on every render.
+ Some house keeping wrapping lines to 120 characters.
+ Moves summary of missing data patterns to `sections/_missing.qmd`.
+ Removes `dark_theme_minimal()` from plot of final lasso.
+ Tidies up `sections/_logistic.qmd` to explicitly use `family = binomial(link = "logit")` (**NB** Previous work ensured
  the `train` data frame is used in all logistic regression rather the raw `df` which includes individuals with missing
  `final_pathology`).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants