quarto-dev / quarto-dev/quarto-cli

tbl-subcap fails to render with only single element present

Open
#13,425 1 comment 0 reactions 1 assignee View on GitHub

@cscheid is already working on this.

Since Sep 26, 2025.

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

Description

I have:
  • searched the issue tracker for similar issues
  • installed the latest version of Quarto CLI
  • formatted my issue following the Bug Reports guide
Bug description

Rendering a document with a label and tbl-subcap with a single element causes a rendering error. Rendering succeeds if the label is removed or another tbl-subcap element is added.

Steps to reproduce

Attempt to render this document:

---
title: "test"
format: html
---

## Quarto table

```{r}
#| label: tbl-trivial
#| tbl-cap: "Trivial Caption" 
#| tbl-subcap:
#|  - "Trivial subcaption"
library(dplyr)
mtcars |> 
  head() |>
  knitr::kable()
```
Actual behavior

Attempting to render yields this error:

> quarto render test.qmd
- The project is out-of-sync -- use `renv::status()` for details.


processing file: test.qmd
1/3              
2/3 [tbl-trivial]
3/3              
output file: test.knit.md

pandoc 
  to: html
  output-file: test.html
  standalone: true
  section-divs: true
  html-math-method: mathjax
  wrap: none
  default-image-extension: png
  variables: {}
  
metadata
  document-css: false
  link-citations: true
  date-format: long
  lang: en
  title: test
  editor: visual
  
ERROR (/Applications/quarto/share/pandoc/datadir/_json.lua:212) unexpected character 'T' at line 1 col 1
Error running filter /Applications/quarto/share/filters/main.lua:
/Applications/quarto/share/pandoc/datadir/_json.lua:193: bad 'for' initial value (number expected, got nil)
stack traceback:
	/Applications/quarto/share/pandoc/datadir/_json.lua:407: in function '_json.decode'
	/Applications/quarto/share/filters/main.lua:17238: in local 'fn'
	/Applications/quarto/share/filters/main.lua:2927: in function </Applications/quarto/share/filters/main.lua:2921>
	(...tail calls...)
	...uarto/share/pandoc/datadir/../../filters/modules/jog.lua:34: in upvalue 'run_filter_function'
	...uarto/share/pandoc/datadir/../../filters/modules/jog.lua:223: in function <...uarto/share/pandoc/datadir/../../filters/modules/jog.lua:202>
	(...tail calls...)
	[C]: in function 'pandoc.List.map'
	...uarto/share/pandoc/datadir/../../filters/modules/jog.lua:125: in upvalue 'recurse'
	...uarto/share/pandoc/datadir/../../filters/modules/jog.lua:222: in local 'jogger'
	...uarto/share/pandoc/datadir/../../filters/modules/jog.lua:171: in upvalue 'recurse'
	...uarto/share/pandoc/datadir/../../filters/modules/jog.lua:222: in function <...uarto/share/pandoc/datadir/../../filters/modules/jog.lua:202>
	(...tail calls...)
	/Applications/quarto/share/filters/main.lua:572: in function </Applications/quarto/share/filters/main.lua:550>
	(...tail calls...)
	/Applications/quarto/share/filters/main.lua:1314: in local 'callback'
	/Applications/quarto/share/filters/main.lua:1332: in upvalue 'run_emulated_filter_chain'
	/Applications/quarto/share/filters/main.lua:1368: in function </Applications/quarto/share/filters/main.lua:1365>
WARN: Should not have arrived here:
ERROR: [non-error-thrown] undefined

Stack trace:
    at _Command.handleError (file:///Applications/quarto/bin/quarto.js:10032:117)
    at _Command.parseCommand (file:///Applications/quarto/bin/quarto.js:9719:12)
    at eventLoopTick (ext:core/01_core.js:178:7)
    at async quarto (file:///Applications/quarto/bin/quarto.js:175522:5)
    at async file:///Applications/quarto/bin/quarto.js:175550:5
    at async file:///Applications/quarto/bin/quarto.js:175405:14
    at async mainRunner (file:///Applications/quarto/bin/quarto.js:175407:5)
    at async file:///Applications/quarto/bin/quarto.js:175543:3
Expected behavior

I would expect the document to render successfully.

Your environment

MacOS Tahoe 26.0

Quarto check output
Quarto 1.8.24
[✓] Checking environment information...
      Quarto cache location: /Users/matthew/Library/Caches/quarto
[✓] Checking versions of quarto binary dependencies...
      Pandoc version 3.6.3: OK
      Dart Sass version 1.87.0: OK
      Deno version 2.3.1: OK
      Typst version 0.13.0: OK
[✓] Checking versions of quarto dependencies......OK
[✓] Checking Quarto installation......OK
      Version: 1.8.24
      Path: /Applications/quarto/bin

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

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

[✓] 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.13.7
      Path: /opt/homebrew/opt/python@3.13/bin/python3.13
      Jupyter: (None)

      Jupyter is not available in this Python installation.
      Install with python3 -m pip install jupyter

[✓] Checking R installation...........OK
      Version: 4.5.1
      Path: /Library/Frameworks/R.framework/Versions/4.5-arm64/Resources
      LibPaths:
        - /Users/matthew/code/sandbox/support-122744/renv/library/macos/R-4.5/aarch64-apple-darwin20
        - /Users/matthew/Library/Caches/org.R-project.R/R/renv/sandbox/macos/R-4.5/aarch64-apple-darwin20/4cd76b74
      knitr: 1.50
      rmarkdown: 2.29

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

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.