.yaml error message

Does anyone have any idea about this error, which I get whenever I start RStudio and load a package? I'm running 3.4.3 and all packages are up to date.

Warning message:
In readLines(con) :
incomplete final line found on '/Library/Frameworks/R.framework/Versions/3.4/Resources/library/raw/rmarkdown/templates/reserveReview/template.yaml'

1 Like

Interesting. To narrow the problem I might try removing the raw package (see the documentation for remove.packages). If the problem goes away try reinstalling the newest version of the package and see if it comes back.

Thanks for that. The error does indeed go away when I remove the raw package, but reinstalling it returns the error.
No big deal - I guess I can live with it. Not sure how it's affecting functionality though.

Next step might be to open the template.yaml file to see if there is anything glaring. A guess is the 'incomplete final line' may refer to there not being a blank final line...if that's the case you could try just inserting one...based on the documentation for readLines the warning is just an FYI.

See details in ?readLines

If the final line is incomplete (no final EOL marker) the behaviour depends on whether the connection is blocking or not. For a non-blocking text-mode connection the incomplete line is pushed back, silently. For all other connections the line will be accepted, with a warning.


Thank you,

Adding an additional empty line to the end of that particular yaml file did indeed work!


Yeah, YAML is whitespace sensitive, so trailing lines or lack thereof, extra spaces, etc. are always good places to start for troubleshooting there.

1 Like

I encountered this bug too, which occurs if raw is simply installed (i.e. even if not attached or loaded). I'd be interested to know why RStudio emits this warning. I'm guessing it's something to do with obtaining package metadata to populate the package pane, in which case it might be good to petition R-core to modify QC.R to add a NOTE to a package if any file doesn't have trailing newlines.

The template.yaml file here is for a rmarkdown template. This file are used by rmarkdown::draft to create a new file from template or by RStudio File > New File > R markdown... > From Template. To be able to list all templates available, RStudio read through each template.yaml found in packages present in the library. Base on the metadata found, the template can be rendered in RStudio IDE.

Documentation for template is here

The yaml is read by RStudio using yaml::yaml.load_file that calls readLines - the function responsible for the warning.

Standard yaml for template should be:

name: name to print in RStudio IDE
description: >
  Description when mouse is above the template
create_dir: false 

(create_dir is for enforcing the creation of a new directory when creating the template (see help("draft", "rmarkdown"))

the template.yaml file from the raw :package: seems to have an incomplete final line (no EOL marker). This should be fix for this package but I can't find the source on github.


Thank you. I tried this in my yaml file. It doesn't work.

How did you add the empty line? 'Enter' after the final line?