RMarkdown error in YAML

This is not the case but the same type of error can occur when using pkgdown::build_site or, more viciously, pkgdown::build_article. When using the latter to build a specific vignette for a package, I noticed that internally the headers of all the vignettes are parsed. Therefore, even if the specific vignette you are building is correct, the error occurs without specification of which file's header is corrupt. So, you might find yourself struggling to debug a header which is in fact correct, when the problem is in another file.


Another frequent cause of this error message is using tabs instead of spaces to indent your YAML code. You can only use SPACES to indent YAML, not TABS. I am writing this for my future self to find here.

title: "Initial Results"
output: 
  pdf_document:
    toc: true

The issue came from copying the code from the browser to Rstudio.

The original header information was:

---
title: "Linked brushing"
output: html_document
runtime: shiny
---

the pasted text was:

---
  title: "Linked brushing"
output: html_document
runtime: shiny
---

The missing <document start> was an unequal amount of white space before each element of the header. This can be fixed by adding white space to the 'output' and 'runtime' lines or by removing the white space of the 'title' line.