Systematic approach to diagnose and recover from pandoc PDF conversion unknown errors
66
78%
Does it follow best practices?
Run evals on this skill
Adds up to 20 points to the overall score
View guide
Medium
Suggest reviewing before use
Fix and improve this skill with Tessl
tessl review fix ./benchmarks/gdpval/skills/pandoc-pdf-error-recovery/SKILL.mdWhen pandoc fails to convert documents to PDF with an "unknown error" or similar vague message, follow this systematic diagnostic and recovery workflow.
First confirm pandoc is installed and accessible:
pandoc --versionIf this fails, install pandoc before proceeding:
brew install pandocsudo apt-get install pandoc or sudo yum install pandocIdentify which PDF rendering engines are available on the system:
which pdflatex xelatex lualatex wkhtmltopdf contextCommon engines and their typical use cases:
Try conversion with xelatex first (most versatile for general documents):
pandoc input.md -o output.pdf --pdf-engine=xelatex 2>&1 | tee conversion.logThe 2>&1 | tee pattern captures both stdout and stderr to a log file for analysis.
If conversion fails, examine the captured log:
cat conversion.logCommon error patterns and solutions:
tlmgr install <package> or system package manager-V mainfont="Font Name"Systematically try other available engines:
# Fallback to pdflatex
pandoc input.md -o output.pdf --pdf-engine=pdflatex 2>&1 | tee conversion-pdflatex.log
# Or try wkhtmltopdf for HTML-rich content
pandoc input.md -o output.pdf --pdf-engine=wkhtmltopdf 2>&1 | tee conversion-wkhtmltopdf.log
# Or try lualatex for complex documents
pandoc input.md -o output.pdf --pdf-engine=lualatex 2>&1 | tee conversion-lualatex.logIf all engines fail or are missing, install required packages:
# Full TeX Live installation (comprehensive but large)
sudo apt-get install texlive-full
# Or minimal installation with common packages
sudo apt-get install texlive-latex-base texlive-fonts-recommended
# For xelatex font support
sudo apt-get install fonts-noto fonts-dejavuIf errors persist, try conversion with minimal options:
pandoc input.md -o output.pdf --pdf-engine=xelatex --standaloneRemove complex formatting, custom headers, or advanced LaTeX features that may be causing issues.
Complete diagnostic one-liner:
pandoc --version && which pdflatex xelatex wkhtmltopdf && pandoc input.md -o output.pdf --pdf-engine=xelatex -v2>&1) to see the actual error message-v (verbose) flag for more detailed output during troubleshootingc5a9c4b
If you maintain this skill, you can claim it as your own. Once claimed, you can manage eval scenarios, bundle related skills, attach documentation or rules, and ensure cross-agent compatibility.