Skip to content

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

@mcaselli

Description

@mcaselli

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...

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingengines-knitrAnything regarding knitr enginesupstreamBug is in upstream library

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions