This is an error with Pandoc itself I think. I see you are using OneDrive and this could also be a cause maybe.
Which Pandoc version are you using ? rmarkdown::pandoc_version()
As it could also be linked to the specific content of your file, Can you share a reproducible example ? Like the Rmd that do not work ?
You can also try outside of OneDrive folder to rule out OneDrive possible cause in this.