'RMarkdown: Error in dir.exists(x) : file name conversion problem -- name too long?

I am working on serial reports with RMarkdown. Since the latest R Update to 4.2.0 I get the error:

Error in dir.exists(x) : file name conversion problem -- name too long?

This is the Script I am working with:

setwd("C:/Hannah/Traegerberichte")

## Data
project.numbers <- c("2022000943 - 1", "2022000348 - 2",  "2022000346 - 4", "2022000346 - 4", "2022000943 - 1", "2022000669 - 2")

## Loop
for (i in seq_along(project.numbers)){
  rmarkdown::render(input = "Reports.Rmd",
                    output_format = "pdf_document",
                    output_file = paste("report_", i, ".pdf", sep=''),
                    output_dir = "pdf-Berichte/")

The Reports.Rmd does contain reading excel files with long names an "ß" in the directory name. But they work without any problems, when I just run them alone: df <- openxlsx::read.xlsx("C:/Users/.... ß ..../... .xles I tried loadings the xlsx before and then outcomment these parts, but that does not change anything.

traceback() gives me this information:

> traceback()
8: dir.exists(x)
7: utils::file_test("-d", x)
6: dir_exists(src)
5: FUN(X[[i]], ...)
4: lapply(sources, function(src) {
       if (dir_exists(src)) 
           get_pandoc_version(src)
       else numeric_version("0")
   })
3: find_pandoc()
2: pandoc_available(required_pandoc, error = TRUE)
1: rmarkdown::render(input = "Reports.Rmd", output_format = "pdf_document", 
       output_file = paste("report_", i, ".pdf", sep = ""), output_dir = "pdf-Berichte/")


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source