Skip to main content

Appendix F — Quarto Troubleshooting Guide

A reproducible publication is not simply a document that rendered once on its author’s computer. It is a document whose dependencies, inputs, configuration and publication process can be reconstructed. This appendix provides a systematic approach to diagnosing failures without sacrificing manuscript history or research integrity.

F.1 F.1 Establish a diagnostic baseline

Save your source files and record the exact command that failed. Preserve the first meaningful error, not merely the final message announcing that rendering stopped. Record the operating system, working directory, Quarto version and computational engine. Remove credentials and confidential data before sharing logs.

quarto --version
quarto check
quarto check knitr
quarto check jupyter
git status -sb

Start with a minimal document containing a title and one paragraph. If it renders, introduce the failing feature alone. If it does not, investigate installation or configuration before editing the textbook. Use a temporary directory outside the book for experiments. A successful standalone render does not guarantee a successful book render: inherited metadata, bibliography and relative paths can differ.

F.2 F.2 Installation and executable discovery

If the terminal reports that quarto is not recognized, verify that the application is installed and discoverable through PATH. On Windows PowerShell use Get-Command quarto; on macOS or Linux use command -v quarto. Restart the terminal after installation. Compare the version in your IDE with the version reported by the terminal. Do not reinstall all computational packages merely because the Quarto executable cannot be found.

A minimal HTML test requires no R or Python engine when it contains no executable cells. Render it with quarto render minimal.qmd --to html. Once this succeeds, test the computational engines separately.

F.3 F.3 R and knitr failures

Run these commands in the R console:

R.version.string
sessionInfo()
.libPaths()
requireNamespace("knitr", quietly = TRUE)
requireNamespace("rmarkdown", quietly = TRUE)

If a package is missing, install it into the library used by the rendering session, not an unrelated R installation. For example, install.packages(c("knitr", "rmarkdown")) installs the core dependencies for a knitr workflow. If a package is present but cannot load, read the dependency or shared-library error before updating it. An object-not-found error usually means that the object was never created in the fresh rendering session, even if it exists in the interactive console.

A common classroom example is a confidence interval calculation that uses x from a previous console session. Define the data inside the document, check the number of observations and handle missing values explicitly. For the synthetic waiting times 10, 12, 15, 18 and 25 minutes, the mean is 16. If a render produces a different mean, inspect the input rather than editing the displayed result.

F.4 F.4 Python and Jupyter failures

python --version
python -m pip show jupyter numpy pandas
python -m jupyter kernelspec list
quarto check jupyter

In a Python cell, import sys; print(sys.executable) reveals the interpreter actually running the code. Compare it with the interpreter used to install packages. A kernel name is a label, not proof that the underlying environment still exists.

Create a dedicated environment when necessary with python -m venv .venv. Activate it using .venv\Scripts\Activate.ps1 on Windows PowerShell or source .venv/bin/activate on POSIX shells. Install dependencies using python -m pip install -r requirements.txt. If activation is restricted, invoke the environment’s Python executable directly rather than weakening system-wide security settings.

Register a kernel if needed with python -m ipykernel install --user --name quarto-book --display-name "Python (quarto-book)" after installing ipykernel in the environment. Set jupyter: quarto-book in the document metadata. Verify the interpreter again inside the rendered document. Never commit .venv to the repository.

F.5 F.5 YAML and Markdown errors

YAML indentation defines structure. Use spaces, not tabs, and quote values containing punctuation that could be interpreted as YAML syntax.

Incorrect:

format:
html:
  toc: true

Correct:

format:
  html:
    toc: true

The first example can be syntactically valid YAML while being structurally incorrect for Quarto. A generic YAML parser cannot validate every Quarto option. Also check duplicate keys, mismatched quotation marks and whether front matter begins and ends with three hyphens. A code fence that is never closed can cause the rest of a chapter to appear as source code. Use four backticks around examples that contain triple-backtick fences.

F.6 F.6 Data and figure paths

A path that works on one computer may fail on another. Avoid absolute paths to a personal Downloads folder. Use project-relative paths and verify the execution directory. In R use getwd() and file.exists(); in Python use Path.cwd() and Path(...).is_file(). For a project with execute-dir: project, construct paths relative to the project root; otherwise inspect the actual working directory rather than assuming it.

Linux hosting is generally case-sensitive. A reference to Clinic.csv will fail when the file is named clinic.csv. Check whether Git tracks the file and whether ignore rules exclude it. For a case-only rename on a case-insensitive filesystem, rename through an intermediate filename with git mv.

Distinguish a source image from a generated image. Source figures should be tracked or distributed with the manuscript; generated figures should have reproducible code and inputs. A missing figure is not corrected by suppressing the error.

F.7 F.7 Mathematics, citations and cross-references

Use $...$ for inline math and $$...$$ for displayed mathematics. Check balanced braces and matching environments. Test an expression such as $\bar{x}$ in isolation before adding custom macros. Prefer portable commands for HTML, PDF and Word.

$$
\bar{x}=\frac{1}{n}\sum_{i=1}^{n}x_i
$$ {#eq-appf-mean}

See @eq-appf-mean.

A reference label must match exactly and be unique across a book. Figure labels begin with fig-, table labels with tbl-, and equation labels with eq-. A citation such as [@smith2020] requires a matching bibliography entry. Inspect the bibliography path and citation key before changing the citation style. Render the entire book to test references across chapters.

F.8 F.8 PDF and LaTeX compilation

If HTML succeeds but PDF fails, isolate the PDF-specific problem. Run quarto check and verify that a supported TeX distribution is installed. Quarto can install TinyTeX with quarto install tinytex when appropriate. Read the first LaTeX error in the log. Missing packages, unsupported Unicode characters, unavailable fonts and oversized tables are distinct problems.

Temporarily enable keep-tex: true under the PDF format to inspect the generated TeX. Do not edit the generated TeX as the permanent fix: change the QMD or configuration that generated it. If a table exceeds the page width, shorten headers, split the table or use a PDF-specific layout only when necessary. Test the HTML edition again after making changes.

F.9 F.9 Caching and stale results

A successful render can still contain outdated computations. Distinguish execution cache from Quarto freeze and from browser caching. freeze: auto may reuse computational results when the source document is unchanged; an external dataset change may not trigger recomputation. Explicitly render the affected document and verify the output against the revised data. For knitr or Jupyter caching, quarto render report.qmd --cache-refresh requests refreshed cached computations. Do not delete source data or uncommitted work when clearing generated artifacts. Preserve a copy of the last successful publication.

F.10 F.10 GitHub Pages and continuous integration

Quarto documents three publication approaches for GitHub Pages: committing rendered files in docs, publishing through the Quarto command, or using an automated GitHub Action. Choose one approach for each repository and ensure that Pages settings agree with it. See GitHub Pages publishing.

A local success followed by a CI failure often indicates an undeclared dependency, a missing tracked file, case-sensitive paths or a different interpreter. Inspect the failing step and its logs. A successful build followed by a deployment failure suggests permissions, Pages configuration or an incorrect artifact directory. Verify the deployed commit, not just the latest commit in the source branch.

For a book with output-dir: _book, check that the deployment artifact contains _book/index.html before uploading its contents. If publishing from a branch and /docs, the actual output directory must instead be docs. Do not switch publication methods merely to silence an unrelated computational error.

F.11 F.11 Cloudflare Pages and multi-book routing

Separate build errors from routing errors. If the direct book origin fails, investigate the book deployment first. If the origin works but the portal URL fails, investigate the routing layer. Confirm the production branch, build command and output directory. When uploading pre-rendered files, the upload root should contain index.html, not an extra enclosing _book directory.

For a portal that proxies a book under /book-3/, test the landing page, a chapter, a stylesheet, an image and search resources. A root-relative asset URL such as /site_libs/... may bypass the book prefix and reach the portal instead. Relative links generally work better, but generated navigation, canonical URLs, redirects and search must be inspected individually. Redirects from the upstream origin may require rewriting to preserve the public prefix. Do not assume a successful landing page proves that the entire book works.

curl -I https://example.org/book-3/
curl -I https://example.org/book-3/chapter-1.html

Replace these illustrative URLs with your own. A 404 suggests an absent resource or incorrect route; a 502 suggests an upstream or proxy failure; repeated 3xx responses suggest a redirect loop. A 200 response may still contain an HTML fallback instead of a JavaScript or CSS file: inspect the content type and response body. Test the origin and portal separately. Never forward secrets to an arbitrary origin; validate allowed upstream hosts and prevent proxy loops.

F.12 F.12 Diagnostic decision tree

  1. Does a minimal noncomputational HTML document render? If not, check installation and YAML.
  2. Does a minimal computational document render? If not, check the selected engine and dependencies.
  3. Does the affected chapter render? If not, isolate its inputs, code and markup.
  4. Does the complete book render? If not, inspect project configuration, cross-references and shared resources.
  5. Does the deployed origin serve the correct edition? If not, inspect the build and publication settings.
  6. Does the portal serve chapters and assets correctly? If not, inspect URL routing and redirects.

F.13 F.13 Guided practice

  1. Explain why a missing Quarto executable is not fixed by installing pandas.
  2. Correct the YAML indentation in F.5 and explain why parsing alone is insufficient.
  3. Diagnose a Python package installed into the wrong interpreter.
  4. Explain why an R object exists interactively but not during rendering.
  5. Correct a case mismatch between Clinic.csv and clinic.csv.
  6. Diagnose an unresolved @eq-appf-mean reference.
  7. Describe how to investigate a PDF-only failure.
  8. Explain why changing a CSV may not invalidate frozen computations.
  9. Diagnose a successful CI build that deploys an empty directory.
  10. Diagnose a portal landing page that works but its stylesheet returns HTML.

F.14 F.14 Applied project: repair a reproducible report

Use the deliberately faulty examples in examples/appendix-f. Preserve the original fixtures, run the diagnostic script, and create corrected copies. Render the corrected report locally. Record each symptom, hypothesis, test, correction and verification. Include the mean of the synthetic waiting times, a labeled equation and an explanation of the limitations of the data. Submit the corrected source, rendered report and diagnostic log. Award five points each for diagnosis, safe repair, numerical accuracy, reproducibility and documentation (25 total).

F.15 F.15 Preventive maintenance

Before publication, render from a clean checkout in an isolated environment, verify dependencies and inspect all output formats. Keep a record of the source commit and software versions. Test chapter navigation and assets after deployment. Preserve the previous reviewed release. Never publish patient-level records or credentials in source, logs, generated HTML or Git history. Use synthetic or appropriately authorized data and follow institutional requirements.

F.16 Further reading