A Typst project render cannot find the bibliography file in `output-dir`

Open
#1,011 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
68/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Active
Tech stack
rust
Domain
tooling

Research direction

Start in crates/quarto-core/src/transforms/resource_collector.rs, where the issue says resource copies are collected from the document AST, and compare that with the flush-before-compile step in crates/quarto-core/src/pipeline.rs. Run the provided reproduction with citeproc: false and output-dir: _site; done means references.bib is available beside _site/index.typ and rendering produces _site/index.pdf.

Written by the indexing model from the issue text.

Description

Bug description

In a project with output-dir: _site, a Typst document with bibliography: references.bib and citeproc: false fails on q2, and Quarto 1 renders it.
The generated _site/index.typ contains #bibliography(("references.bib")), but q2 never copies references.bib into _site, so typst compile cannot open it.

q2 already flushes the collected resource copies before the Typst compile step, which fixed the same failure for images:

https://github.com/quarto-dev/q2/blob/a2a1cb948b1aec42c93200b880dc73567160f691/crates/quarto-core/src/pipeline.rs#L803-L813

The collector that builds those copies walks the document AST for image targets.
A bibliography: value sits in the metadata, so no copy is queued for it:

https://github.com/quarto-dev/q2/blob/a2a1cb948b1aec42c93200b880dc73567160f691/crates/quarto-core/src/transforms/resource_collector.rs#L466-L478

With citeproc: true the failure does not appear, because q2 resolves the citations itself and no #bibliography call is written.
The cause is my reading of the source.
The run confirms the missing file, and I have not checked that a queued copy fixes it.

Steps to reproduce

_quarto.yml:

project:
  output-dir: _site

index.qmd:

---
format: typst
bibliography: references.bib
citeproc: false
---

[@a]

references.bib:

@book{a, title={A}, author={B}, year={2000}}

With q2:

q2 render

With Quarto 1:

quarto render
Actual behavior

q2 fails and leaves only _site/index.typ:

Error [Q-21-3]: typst compile exited with exit status: 1:
error: file not found (searched at /private/tmp/q2-typst.AqB0/_site/references.bib)
    ┌─ _site/index.typ:438:14
    │
438 │ #bibliography(("references.bib"))
    │               ^^^^^^^^^^^^^^^^^^

Quarto 1 writes _site/index.pdf.

Expected behavior

q2 copies references.bib next to _site/index.typ before it compiles, so _site/index.pdf is written, as in Quarto 1.

Your environment
  • q2: Q2 (quarto 2) 0.40.0-nightly.20261101 (nightly built from a2a1cb9).
  • Quarto 1 for comparison: 1.12.0 (pre-release).
  • OS: macOS 27.2 (arm64).
  • Terminal, no IDE.
Dominant language
Rust
Stars
302
Forks
22
Avg merge
5h 2m
Merged PRs (30d)
213

Getting set up

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.

More from quarto-dev/q2

All issues in quarto-dev/q2

Similar issues

More Rust issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.