![image](https://user-images.githubusercontent.com/285675/187241684-5065beee-8c67-4e57-bfd5-c031e3da0281.png)

The following error message is very hard to read:

```
Key sidebar has value background: primary
    logo: "images/logo.png"
...
      - href: schedule.qmd
        text: Schedule, which must be `true` or `false`
```

There are two problems here.

## Formatting

We can improve formatting in at least three ways. If we're going to print object values that violate the schema, we should always print them by themselves instead of wrapping text around them. That error should then read like so:

```
Key sidebar has value 

background: primary
logo: "images/logo.png"
...
  - href: schedule.qmd
    text: Schedule

which must be `true` or `false`
```

I think we also shouldn't use the work `key`, we should use the word `field`.

Finally, when we're emitting error messages in contexts that have no color formatting, we should consistently use quotes (as we already do in `'true'` and `'false'`). The error should read

```
Field "sidebar" has value 

background: primary
logo: "images/logo.png"
...
  - href: schedule.qmd
    text: Schedule

which must be "true" or "false"
```

## Better information in the case of short suggestions

This error is especially bad, though, in that it suggests that the replacement value _has_ to be `true` or `false`.
The problem is that although these replacements work, they are not the only options. The other alternatives, though, are more complicated schemas, and our short error report doesn't show that.
Our error heuristics should try to offer short suggestions, but they should not mislead.

cscheid
2022-08-29T15:59:58Z
cscheid
enhancement yaml-validation
v1.2
closed
Improve YAML validation error messages
https://github.com/quarto-dev/quarto-cli/issues/2191