quarto-dev / quarto-dev/quarto-cli

_files directory left behind with embed-resources when document contains a cached code chunk

Open
#14,154 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug engines-knitr upstream
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

With embed-resources: true in a _quarto.yml file, we don't get a self-contained HTML file if there's a cached code chunk, instead the DocName_files directory is left behind. Note that if this directory is manually deleted, the HTML file gets deleted with it.

If no cached chunks are present, the output is as expected, i.e. there's no _files directory left behind, and we get a self-contained HTML file.

Steps to reproduce

Establish a directory with the following 3 files:

_quarto.yml:

project:
  title: "TestQuarto"
  output-dir: "output"

format:
  html:
    embed-resources: true

CacheBug.qmd

---
title: "CacheBug"
---

```{r}
#| label: setup
library(ggplot2)
library(dplyr)
```

```{r}
#| label: a_plot
ggplot(mtcars, aes(x = wt, y = mpg)) +
  geom_point()
```

```{r}
#| label: a_code_chunk
#| cache: true
foo <- mtcars |>
  group_by(cyl) |>
  summarise(mean_mpg = mean(mpg))
```

```{r}
#| label: a_table
foo 
```

NoCacheNoBug.qmd

---
title: "NoCacheNoBug"
---

```{r}
#| label: setup
library(ggplot2)
library(dplyr)
```

```{r}
#| label: a_plot
ggplot(mtcars, aes(x = wt, y = mpg)) +
  geom_point()
```

```{r}
#| label: a_code_chunk
#| cache: false
foo <- mtcars |>
  group_by(cyl) |>
  summarise(mean_mpg = mean(mpg))
```

```{r}
#| label: a_table
foo 
```

Run quarto render from this directory, or preview/render the files using RStudio

Actual behavior

output directory contains: CacheBug.html CacheBug_files/ NoCacheNoBug.html

Expected behavior

output directory contains: CacheBug.html NoCacheNoBug.html

Your environment

RStudio/2026.01.1+403

R version 4.5.2 (2025-10-31 ucrt)
Platform: x86_64-w64-mingw32/x64
Running under: Windows 11 x64 (build 26100)

Quarto check output
$ quarto check
Quarto 1.9.27
[>] Checking environment information...
      Quarto cache location: C:\Users\diskb582\AppData\Local\quarto
[>] Checking versions of quarto binary dependencies...
      Pandoc version 3.8.3: OK
      Dart Sass version 1.87.0: OK
      Deno version 2.4.5: OK
      Typst version 0.14.2: OK
[>] Checking versions of quarto dependencies......OK
[>] Checking Quarto installation......OK
      Version: 1.9.27
      Path: C:\Program Files\Quarto\bin
      CodePage: 1252

[>] Checking tools....................OK
      TinyTeX: (not installed)
      Chromium: (not installed)
      Chrome Headless Shell: (not installed)
      VeraPDF: (not installed)

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

[>] Checking Chrome Headless....................OK
      Using: Chrome found on system
      Path: C:\Program Files (x86)\Microsoft\Edge\Application\msedge.exe
      Source: Windows Registry

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

[>] Checking R installation...........OK
      Version: 4.5.2
      Path: C:/PROGRA~1/R/R-45~1.2
      LibPaths:
        - C:/Users/diskb582/AppData/Local/R/win-library/4.5
        - C:/Program Files/R/R-4.5.2/library
      knitr: 1.50
      rmarkdown: 2.30

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

[>] Checking Python 3 installation....(None)

      Unable to locate an installed version of Python 3.
      Install Python 3 from https://www.python.org/downloads/

[>] Checking Julia installation...

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.

Research direction

Start with the minimal _quarto.yml, CacheBug.qmd, and NoCacheNoBug.qmd reproduction, then run quarto render and compare the output directory for cached versus non-cached chunks. Trace the embed-resources handling for cached code output; done means both HTML files are produced without a CacheBug_files directory and the HTML remains valid if that directory is absent.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, r
Domain
build-system, cli
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
58/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.