Skip to content

Poor error message for invalid bibliography when inlined #6030

@jeanas

Description

@jeanas

Description

When the bibliography YAML code is inlined into the document with #bibliography(bytes("...")), errors in the YAML schema are not reported with an informative error message. Instead the compiler reports "label ... does not exist in the document".

For example, consider the code

This is investigated in @foo.

#bibliography("bib.yml")

where bib.yml contains:

foo:
  type: article
  author: John Doe
  title: Bazing the Foo
  date: March 2009

This produces the message

error: failed to parse YAML (foo.date: date format unknown at line 5 column 9)
  ┌─ bug.typ:1:14
  │
1 │ #bibliography("bib.yml")
  │               ^^^^^^^^^

But on the other hand, consider:

This is investigated in @foo.

#bibliography(bytes("
foo:
  type: article
  author: John Doe
  title: Bazing the Foo
  date: March 2009
"))

This produces:

error: label `<foo>` does not exist in the document
  ┌─ bug2.typ:1:24
  │
1 │ This is investigated in @foo.
  │                         ^^^^

Reproduction URL

No response

Operating system

Linux

Typst version

  • I am using the latest version of Typst

Metadata

Metadata

Assignees

No one assigned

    Labels

    bibliographyAnything about citations and bibliographies.bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions