anthropics/skills · error · RuntimeError
PDF conversion failed: {detail}
Error message
PDF conversion failed: {detail} What it means
Raised when converting a PPTX to PDF via LibreOffice (`soffice --headless --convert-to pdf`) either exits non-zero or produces no output PDF. The message appends LibreOffice's stderr/stdout as detail. It means the external soffice process itself failed or silently produced nothing.
Source
Thrown at skills/pptx/scripts/thumbnail.py:198
img = Image.new("RGB", size, color="#F0F0F0")
draw = ImageDraw.Draw(img)
line_width = max(5, min(size) // 100)
draw.line([(0, 0), size], fill="#CCCCCC", width=line_width)
draw.line([(size[0], 0), (0, size[1])], fill="#CCCCCC", width=line_width)
return img
def convert_to_images(pptx_path: Path, temp_dir: Path) -> list[Path]:
pdf_path = temp_dir / f"{pptx_path.stem}.pdf"
result = run_soffice(
["--headless", "--convert-to", "pdf", "--outdir", str(temp_dir), str(pptx_path)],
capture_output=True,
text=True,
)
if result.returncode != 0 or not pdf_path.exists():
detail = (result.stderr or result.stdout or "").strip()
raise RuntimeError(f"PDF conversion failed: {detail}" if detail else "PDF conversion failed")
result = subprocess.run(
[
"pdftoppm",
"-jpeg",
"-r",
str(CONVERSION_DPI),
str(pdf_path),
str(temp_dir / "slide"),
],
capture_output=True,
text=True,
)
if result.returncode != 0:
raise RuntimeError("Image conversion failed")
return sorted(temp_dir.glob("slide-*.jpg"))
View on GitHub (pinned to f6656c1256)
Solutions
- Run `soffice --headless --convert-to pdf --outdir /tmp test.pptx` manually and read the stderr echoed in the message
- Install LibreOffice (e.g. `apt-get install -y libreoffice` on Debian/Ubuntu) or add it to the CI image
- Clear a stuck profile lock: delete ~/.config/libreoffice/4/user/.lock or run with `-env:UserInstallation=file:///tmp/lo_profile`
- If the file is corrupt/unopenable, repair or regenerate the PPTX before thumbnailing
Example fix
// before
result = run_soffice(["--headless", "--convert-to", "pdf", "--outdir", str(temp_dir), str(pptx_path)], capture_output=True, text=True)
// after: isolated profile avoids the single-instance/profile-lock failure mode
result = run_soffice([
"--headless",
"-env:UserInstallation=file:///tmp/lo_thumb_profile",
"--convert-to", "pdf",
"--outdir", str(temp_dir),
str(pptx_path),
], capture_output=True, text=True) Defensive patterns
Strategy: validation
Validate before calling
import shutil
from pathlib import Path
def can_convert_pptx(pptx_path: Path) -> tuple[bool, str]:
if shutil.which("soffice") is None:
return False, "LibreOffice (soffice) not on PATH"
if not pptx_path.is_file() or pptx_path.stat().st_size == 0:
return False, f"missing or empty file: {pptx_path}"
return True, "" Try / catch
try:
images = convert_to_images(pptx, tmp)
except RuntimeError as e:
log.error("thumbnail pipeline failed: %s", e) # message embeds soffice stderr
raise ThumbnailUnavailable(pptx) from e Prevention
- Bake libreoffice into the CI/dev image and smoke-test `soffice --version` at startup
- Use a dedicated -env:UserInstallation profile per conversion to dodge profile locks
- Fail fast on zero-byte or unopenable pptx inputs before invoking soffice
When it happens
Trigger: Calling convert_to_images(pptx_path, temp_dir) when: LibreOffice is not installed or `soffice` is not on PATH; the .pptx is corrupt/password-protected so LibreOffice aborts; a stale soffice profile lock prevents headless startup; the expected output file temp_dir/{stem}.pdf was not created even though returncode was 0.
Common situations: CI containers without libreoffice installed; first-ever headless run after a crashed LibreOffice leaves a locked user profile (~/.config/libreoffice/4/user/.lock); running while another soffice instance is starting; filenames with characters LibreOffice mangles so the produced PDF name differs from {stem}.pdf.
Related errors
- LibreOffice rendered {len(visible_images)} page(s) for {visi
- Image conversion failed
- 1
- relationship target is not a POSIX part name: {target!r}
- relationship target escapes the package: {target!r}
AI-assisted analysis of anthropics/skills@f6656c1256 (2026-08-14).
Data as JSON: /api/errors/7c808fc9db1248bc.
Report an issue: GitHub.