Why Pandoc does not retrieve the image file?

While there are multiple correct solutions above, I'd like to add that a common cause of this error is syntactical, when the author accidentally wraps the file name in the markdown in quotes:

![my image]("my_image.png")

This will result in pandoc being unable to locate the file. I find this mistake to be easy to make in knitr, since we are intertwining R scripts with markdown.

The correct way to insert the image is:

![my image](my_image.png)

Sadly, Jonathan's answer in the comments worked for me. I added:

<!-- rmarkdown v1 -->

To my document, and it did the trick. He claims that this is because Pandoc on Windows is not great at handling paths.

If someone else would write a better answer, I will gladly erase this one.


I encountered a similar error like this: pandoc.exe: Could not find data file ProjectPart1_files/figure-html/sample_Mean_versus_Theoretical_Mean-1.png Error: pandoc document conversion failed with error 97

And one sentence from this page solved my problem.

"If you run into problems with cached output you can always clear the knitr cache by removing the folder named with a _cache suffix within your document’s directory."

When the error occurred, there exactly existed a folder with name like "ProjectPart1_cache" in the working directory. After I deleted it, the error was removed.