Error message when I try to knit the R markdown code

When I try to knit my r markdown to HTML, I got the following error message. Please help.
pandoc.exe: \: openBinaryFile: invalid argument (Invalid argument)
Error: pandoc document conversion failed with error 1
Execution halted


This means that a file is not found somehow. It could come from several place.
Can you share a more detailed example that reproduce the issue ? Or at least give some details about your environment ?

FAQ: How to Format R Markdown Source

Thanks for the reply. I am using window10. This is the location.
"C:/Users/fyan/AppData/Local/Pandoc/pandoc" +RTS -K512m -RTS --to html4 --from markdown+autolink_bare_uris+tex_math_single_backslash --output Geospatial-raster.html --lua-filter "\fshome01pd\fyan$\Documents\R\win-library\4.1\rmarkdown\rmarkdown\lua\pagebreak.lua" --lua-filter "\fshome01pd\fyan$\Documents\R\win-library\4.1\rmarkdown\rmarkdown\lua\latex-div.lua" --self-contained --variable bs3=TRUE --standalone --section-divs --template "\fshome01pd\fyan$\Documents\R\win-library\4.1\rmarkdown\rmd\h\default.html" --no-highlight --variable highlightjs=1 --variable theme=bootstrap --mathjax --variable "mathjax-url=" --include-in-header "C:\Users\fyan\AppData\Local\Temp\RtmpQnPeKs\rmarkdown-str47141913a79.html"

I see that in your file paths. Are R and R packages installed on a network drive ?

R Markdown and Pandoc does not play well with that unfortunately. I could depend on your Pandoc version also.

Related issue: pandoc: openFile: does not exist (No such file or directory) · Issue #1268 · rstudio/rmarkdown · GitHub and pandoc error with pdf when .Rmd is on network file share (NFS) · Issue #701 · rstudio/rmarkdown · GitHub

It may be something else though as I don't recognized this error message. But could be related to this type of file paths

Thanks for the quick reply. I am pretty sure my R installed at my C drive.

Thank your R Library where packages are installed is on a network drive maybe. Do you recognize the start of this path where files from the rmarkdown packages are looked for ?

I believe this is what is causing the issue.

THis will give you the path of your :package:


can you check ?

Thanks. This is what I got

[1] "\\fshome01pd/fyan$/Documents/R/win-library/4.1"
[2] "C:/Program Files/R/R-4.1.3/library"
[1] "\\fshome01pd/fyan$/Documents/R/win-library/4.1/rmarkdown"

Ok so that confirms what I said. Your packages are installed in this PATH

Do you recognized \\fshome01pd/fyan$/ ? It seems like your personal folder you HOME is on a network drive. Is that the case ?

Sorry for the late reply. I think that is the case. What should I do to fix it?

If possible, you should use a local disk for this.

Otherwise, it would help if you can map your network drive to a letter on your Windows machine.

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.