quarto-dev / quarto-dev/quarto-cli
readInputTargetIndex cache validation ignores metadata-files, causing perpetual cache miss
@cderv is already working on this.
Since Mar 18, 2026.
- Dominant language
- JavaScript
- Stars
- 6k
- Forks
- 458
- Avg merge
- 1d 9h
- Merged PRs (30d)
- 41
Description
readInputTargetIndex validates the on-disk index cache by reading the raw _quarto.yml and computing format keys:
It does not resolve metadata-files before computing formatKeys(). When the format: configuration lives in a file referenced by metadata-files (e.g. _website.yml), formatKeys() returns [] while the cached index has the resolved formats (e.g. ["html"]). The comparison always fails, perpetually invalidating the cache.
This forces readBaseInputIndex to run for every project input on every render, even when nothing has changed. For projects with .R spin scripts, this triggers expensive knitr::spin() calls via R on every render.
Repro
Given this _quarto.yml:
project:
type: website
metadata-files:
- _website.yml
And _website.yml containing:
website:
title: "test"
navbar:
left:
- href: index.qmd
- about.qmd
format:
html:
theme: [cosmo, brand]
css: styles.css
toc: true
Every quarto render index.qmd call rebuilds the index for all project inputs, because the cache check reads raw _quarto.yml (no format: key) and mismatches against the cached projectFormats: ["html"].
Moving the format: block into _quarto.yml makes the cache work correctly.
Full repro: https://github.com/byzheng/quarto-metadata-files-test
Context
Root cause of #14225. The effect is most visible when combined with .R spin scripts (each cache miss triggers 3 R process spawns), but the cache invalidation affects all projects using metadata-files for format configuration.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.