Codecov failing on Travis CI

I have developed packages in R previously using Travis CI and codecov, but never packages that interfaced with Stan. I am in the beginning stages of one now (repo:, but for some reason the code coverage always fails, while everything else succeeds. Here is the error I get on Travis:

Error in file(con, "r") : cannot open the connection
Calls: <Anonymous> -> package_coverage -> add_hooks -> readLines -> file
In addition: Warning messages:
1: In utils::install.packages(repos = NULL, lib = tmp_lib, pkg$path,  :
  installation of package ‘/home/travis/build/wjakethompson/lcdm’ had non-zero exit status
2: In file(con, "r") :
  cannot open file '/tmp/RtmpYQaU1s/R_LIBS2ed17a919085/lcdm/R/lcdm': No such file or directory
Execution halted

It appears that the installation is failing, but I’m not sure why that would be.

Here is the .travis.yml file:
And here is the build history:

Any help would be greatly appreciated!

This looks like codecov is perhaps trying to install your package without having the --preclean argument passed to it.

Also, we are going to have a different build process for rstanarm and rstanarm-like packages for 2.17 that, among other things, does not require the --preclean option. So, you might not worry too much about codecov for now.