More helpful error messages when Quarto options are mis-specified

This is another silly problem, but I'm sure I'm not the only one who has/will run into it! If you mess up your Quarto options and use = instead of : in the code chunk, you will get a pretty impenetrable (to me) error about YAML. For example:

---
title: "Untitled"
format: pdf
editor: visual
---

```{r}
#| label: math
#| echo = false
2 * 2
```

Gives the error

processing file: test.qmd
Error in yaml::yaml.load(meta, handlers = list(expr = parse_only)) : 
  Scanner error: while scanning a simple key at line 2, column 1 could not find expected ':' at line 3, column 1
Calls: .main ... FUN -> parse_block -> partition_chunk -> <Anonymous>
Execution halted

I spent way too much time looking for errors in my header YAML, forgetting that those #| comments are basically YAML now, too.

Not sure if it would be possible, but it would be awesome to have an error message that said something like Scanner error: while scanning the options in chunk 1, ... I was thinking of submitting a feature request on GitHub but wasn't sure if it would be a Quarto request, a knitr request, or something else.

Edit to add: I posted this on the Quarto discussion board on GitHub. That's probably the better place for this discussion.

1 Like

Thanks for the feedback. GIthub Discussion board was indeed the best place for this.

Issue now open

and we can track evolution there.

Thanks a lot!

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.