Skip to content

Missing/null YAML value leads to bad error message #12369

@mcanouil

Description

@mcanouil

If you use the following document (with _quarto.yml):

---
format:
  html:
---

Edit: Here the missing steps to reproduce:

mkdir whatever
cd whatever
echo "---\nformat:\n  revealjs:\n---\n" > index.qmd
quarto render index.qmd # proper error
quarto preview index.qmd # bad error

From an IDE, you get Field "html" has empty value but it must instead be an object but when rendering (edit: via IDE thus preview) you get:

ERROR: TypeError: Cannot read properties of null (reading 'bibliography')

Stack trace:
    at file:///Users/mcanouil/Projects/quarto/quarto-cli/src/command/render/render-contexts.ts:376:29
    at Array.forEach (<anonymous>)
    at fixupMergeableScalars (file:///Users/mcanouil/Projects/quarto/quarto-cli/src/command/render/render-contexts.ts:375:8)
    at file:///Users/mcanouil/Projects/quarto/quarto-cli/src/command/render/render-contexts.ts:392:9
    at Array.forEach (<anonymous>)
    at fixupFormat (file:///Users/mcanouil/Projects/quarto/quarto-cli/src/command/render/render-contexts.ts:388:27)
    at mergeQuartoConfigs (file:///Users/mcanouil/Projects/quarto/quarto-cli/src/command/render/render-contexts.ts:400:5)
    at resolveFormatsFromMetadata (file:///Users/mcanouil/Projects/quarto/quarto-cli/src/command/render/render-contexts.ts:122:23)
    at eventLoopTick (ext:core/01_core.js:175:7)
    at async resolveFormats (file:///Users/mcanouil/Projects/quarto/quarto-cli/src/command/render/render-contexts.ts:482:24)

This error is very missleading and wrong as it should be ERROR: TypeError: Cannot read properties of null (reading 'html') in this case.

Quarto 99.9.9
[✓] Checking environment information...
      Quarto cache location: /Users/mcanouil/Library/Caches/quarto
[✓] Checking versions of quarto binary dependencies...
      Pandoc version 3.4.0: OK
      Dart Sass version 1.85.1: 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: c6994ae096db9fe3efb07ee190d5c732ba6351dd
      Path: /Users/mcanouil/Projects/quarto/quarto-cli/package/dist/bin

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

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

[✓] Checking Chrome Headless....................OK
      Using: Chrome found on system
      Path: /Applications/Brave Browser.app/Contents/MacOS/Brave Browser
      Source: QUARTO_CHROMIUM

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

[✓] Checking Python 3 installation....OK
      Version: 3.13.1
      Path: /Users/mcanouil/Projects/quarto/quarto-playground/.venv/bin/python3
      Jupyter: 5.7.2
      Kernels: julia-1.11, python3

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

(/) Checking R installation...........ℹ R version 4.4.3 (2025-02-28)
! Config '~/.Rprofile' was loaded!
[✓] Checking R installation...........OK
      Version: 4.4.3
      Path: /Library/Frameworks/R.framework/Resources
      LibPaths:
        - /Users/mcanouil/Projects/quarto/quarto-playground/renv/library/macos/R-4.4/aarch64-apple-darwin20
        - /Users/mcanouil/Library/Caches/org.R-project.R/R/renv/sandbox/macos/R-4.4/aarch64-apple-darwin20/f7156815
      knitr: 1.50
      rmarkdown: 2.29

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

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingpreviewissues related to the `preview` commandtriaged-toIssues that were not self-assigned, signals that an issue was assigned to someone.yaml-validationIssues with YAML validation and autocompletion in quarto

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions