Search code examples
r-markdownpandoc

Pandoc error 10 when compiling document and fetching from fonts.gstatic.com


I'm having trouble consistently compiling a particular document with rmarkdown::render. I cannot reproduce the issue reliably, unfortunately (it happens roughly 1/3 of the time), but when it fails, I get the error:

pandoc document conversion failed with error 10

from rmarkdown. The "10" is the return code from the system command that runs pandoc here.

When I set pandoc to give debugging information with --verbose the following lines are the last ones in stderr:

[INFO] Fetching https://fonts.gstatic.com/s/opensans/v34/memvYaGs126MiZpBA-UvWbX2vVnXBbObj2OVTSKmu1aB.woff2...
[INFO] Fetching https://fonts.gstatic.com/s/opensans/v34/memvYaGs126MiZpBA-UvWbX2vVnXBbObj2OVTSumu1aB.woff2...
[INFO] Fetching https://fonts.gstatic.com/s/opensans/v34/memvYaGs126MiZpBA-UvWbX2vVnXBbObj2OVTSOmu1aB.woff2...
[INFO] Fetching https://fonts.gstatic.com/s/opensans/v34/memvYaGs126MiZpBA-UvWbX2vVnXBbObj2OVTSymu1aB.woff2...
[INFO] Fetching https://fonts.gstatic.com/s/opensans/v34/memvYaGs126MiZpBA-UvWbX2vVnXBbObj2OVTS2mu1aB.woff2...
[INFO] Fetching https://fonts.gstatic.com/s/opensans/v34/memvYaGs126MiZpBA-UvWbX2vVnXBbObj2OVTSCmu1aB.woff2...
[INFO] Fetching https://fonts.gstatic.com/s/opensans/v34/memvYaGs126MiZpBA-UvWbX2vVnXBbObj2OVTSGmu1aB.woff2...
Error : pandoc document conversion failed with error 10

The last line varies, but it always seems to be one of these fonts that is the last thing pandoc reports before the error (there are 24 of these font fetches in this particular document, as shown by the output in a successful compile).

This leads me to believe that there is a problem in fetching one of these fonts, but there's no output that says what the problem actually is, and Error 10 does not seem to be a valid error code from pandoc: pandoc error codes.

I'm sort of stuck debugging until I figure this out.

I also note there is a similar issue here: NYTimes and 538 Themes Give Pandoc Error 10 - as a bonus, it even seems to be related to fonts.gstatic.com, but that out seems to be more specific, including a [WARNING] that I don't see in mine.

In case they are helpful, I've put the logs of a failure and success and the pandoc command that was run in a gist here: logs

I'd appreciate any insights into what could cause this and how to fix it.


Edit to add command line:

/opt/homebrew/bin/pandoc +RTS -K512m -RTS index.knit.md --to html4 --from markdown+autolink_bare_uris+tex_math_single_backslash --output index.html --lua-filter /Users/saprm3/Library/Caches/org.R-project.R/R/renv/library/flexTeaching3.api-91d1a6f0/R-4.2/aarch64-apple-darwin20/rmarkdown/rmarkdown/lua/pagebreak.lua --lua-filter /Users/saprm3/Library/Caches/org.R-project.R/R/renv/library/flexTeaching3.api-91d1a6f0/R-4.2/aarch64-apple-darwin20/rmarkdown/rmarkdown/lua/latex-div.lua --embed-resources --standalone --verbose --variable bs3=TRUE --section-divs --template /Users/saprm3/Library/Caches/org.R-project.R/R/renv/library/flexTeaching3.api-91d1a6f0/R-4.2/aarch64-apple-darwin20/rmarkdown/rmd/h/default.html --no-highlight --variable highlightjs=1 --variable theme=bootstrap --mathjax --variable 'mathjax-url=https://mathjax.rstudio.com/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML' --include-in-header /var/folders/59/r7wjy0gn6yv59w19694x5gy80000gp/T//RtmpNWnHRc/rmarkdown-str16c6234aa443c.html 

Solution

  • This is caused by a problem in the homebrew version of pandoc (https://github.com/jgm/pandoc/issues/8779). Installing the non-homebrew release of pandoc, as suggested in the link, eliminates the error.