Skip to content

"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

@nickvigilante

Description

@nickvigilante

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

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions