infiniflow/ragflow · error · Exception
No PDF engine found. Install xelatex.
Error message
No PDF engine found. Install xelatex.
What it means
Raised by DocGenerator._select_pdf_engine (agent/component/docs_generator.py): the component requires xelatex to produce PDF output (needed for CJK font support via -V mainfont/CJKmainfont args), and shutil.which('xelatex') found no xelatex binary on PATH. This is an environment dependency error, not a configuration error.
Source
Thrown at agent/component/docs_generator.py:281
include_timestamp_in_body: bool = True,
) -> tuple[str, bytes]:
import pypandoc
markdown_content = self._build_markdown_source(
content,
include_timestamp_in_body=include_timestamp_in_body,
)
converted_content = pypandoc.convert_text(
markdown_content,
to=target_format,
format="markdown",
)
return self._write_bytes_output(converted_content.encode("utf-8"), extension)
def _select_pdf_engine(self) -> str:
if shutil.which("xelatex"):
return "xelatex"
raise Exception("No PDF engine found. Install xelatex.")
def _get_pdf_font_args(self) -> list[str]:
return [
"-V",
f"mainfont={self._pdf_main_font}",
"-V",
f"CJKmainfont={self._pdf_cjk_font}",
]
def _get_pdf_overlay_font_name(self) -> str:
from reportlab.pdfbase import pdfmetrics
from reportlab.pdfbase.cidfonts import UnicodeCIDFont
try:
pdfmetrics.getFont(self._pdf_overlay_font)
except KeyError:
pdfmetrics.registerFont(UnicodeCIDFont(self._pdf_overlay_font))
View on GitHub (pinned to 554fb1133a)
Solutions
- Install TeX Live with xelatex: on Debian/Ubuntu 'apt-get install -y texlive-xetex' (plus texlive-fonts-recommended for Noto/STSong fonts)
- In Docker, add the same packages to the image and rebuild so xelatex is on PATH
- Verify with 'which xelatex' / 'xelatex --version' in the exact environment the backend worker runs in
- As a workaround, switch output_format to 'docx', 'html', 'txt', or 'markdown', which do not need a TeX engine
Example fix
# before: Dockerfile without TeX FROM ragflow-base # after RUN apt-get update && apt-get install -y --no-install-recommends texlive-xetex texlive-fonts-recommended
Defensive patterns
Strategy: fallback
Validate before calling
import shutil
def pdf_engine_available() -> bool:
return shutil.which('xelatex') is not None
if not pdf_engine_available():
raise EnvironmentError('PDF output requires xelatex; install texlive-xetex or choose another output_format') Try / catch
try:
path, data = generator._generate_pdf(content)
except Exception as e:
if 'No PDF engine found' in str(e):
path, data = generator._generate_docx(content) # degrade gracefully, notify user
else:
raise Prevention
- Install texlive-xetex (and CJK fonts) in images that will run DocGenerator with pdf output
- Add a startup capability check for xelatex and disable/annotate the pdf option when absent
- Prefer docx/html output in environments where a TeX toolchain is impractical
When it happens
Trigger: Running an agent canvas with a DocGenerator component whose output_format is 'pdf' on a host or container where TeX Live (xelatex) is not installed or not on PATH. The check is unconditional: only xelatex is accepted, then Exception('No PDF engine found. Install xelatex.').
Common situations: Slim Docker images without TeX Live; local venv installs of RAGFlow without system packages; CI runners lacking texlive; PATH not including /usr/local/texlive/*/bin/* after a manual TeX install.
Related errors
- PDF generation failed: {str(e)}
- Document file is empty
- DOCX generation failed: {str(e)}
- TXT generation failed: {str(e)}
- Markdown generation failed: {str(e)}
AI-assisted analysis of infiniflow/ragflow@554fb1133a (2026-08-15).
Data as JSON: /api/errors/3106b388177ec338.
Report an issue: GitHub.