Rmarkdown: Error: pandoc document conversion failed with error 1

Hi, after updating RStudio, R and all my packages, an existing code based on rmarkdown fails with the error:

pandoc.exe: \: withBinaryFile: invalid argument (Invalid argument)
Error: pandoc document conversion failed with error 1
Execution halted

Does anybody know why this fails?
Thanks for your help!

System info:

sessionInfo()
R version 4.4.1 (2024-06-14 ucrt)
Platform: x86_64-w64-mingw32/x64
Running under: Windows 10 x64 (build 19045)

Matrix products: default

locale:
[1] LC_COLLATE=German_Switzerland.utf8 LC_CTYPE=German_Switzerland.utf8 LC_MONETARY=German_Switzerland.utf8 LC_NUMERIC=C LC_TIME=German_Switzerland.utf8

time zone: Europe/Zurich
tzcode source: internal

attached base packages:
[1] stats graphics grDevices utils datasets methods base

other attached packages:
[1] rmarkdown_2.27 ggplot2_3.5.1 lubridate_1.9.3

loaded via a namespace (and not attached):
[1] gtable_0.3.5 dplyr_1.1.4 compiler_4.4.1 tidyselect_1.2.1 Rcpp_1.0.13 stringr_1.5.1 scales_1.3.0 yaml_2.3.9 fastmap_1.2.0 readr_2.1.5 R6_2.5.1 plyr_1.8.9 generics_0.1.3 knitr_1.48 tibble_3.2.1 munsell_0.5.1 pillar_1.9.0
[18] tzdb_0.4.0 rlang_1.1.4 utf8_1.2.4 stringi_1.8.4 xfun_0.46 timechange_0.3.0 cli_3.6.3 withr_3.0.0 magrittr_2.0.3 digest_0.6.36 grid_4.4.1 rstudioapi_0.16.0 hms_1.1.3 lifecycle_1.0.4 vctrs_0.6.5 evaluate_0.24.0 glue_1.7.0
[35] fansi_1.0.6 colorspace_2.1-0 reshape2_1.4.4 tools_4.4.1 pkgconfig_2.0.3 htmltools_0.5.8.1

RStudio Version:
RStudio 2024.04.2+764 "Chocolate Cosmos" Release (e4392fc9ddc21961fd1d0efd47484b43f07a4177, 2024-06-05) for windows
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) RStudio/2024.04.2+764 Chrome/120.0.6099.291 Electron/28.3.1 Safari/537.36, Quarto 1.4.555

Pandoc version:
pandoc_available()
TRUE
pandoc_version()
‘3.1.11’

There is not enough information to help you here unfortunately. Can you share your document ?
Try also rmarkdown::render() outside of RStudio IDE in R console ?

Thanks

Thanks. I figured out that the path to my .docx template file was the culprit. I had to change my template path in the header of the markdown-file from an absolute path to a relative one and now everything works. The path I used before was correct though, the code was running fine before the update.