Documents render_docx.py fails on Windows with LibreOffice temporary UserInstallation profile
Summary
The Documents plugin renderer render_docx.py fails on Windows when it launches LibreOffice with a temporary UserInstallation profile. Direct LibreOffice conversion of the same DOCX succeeds, and Poppler PDF-to-PNG conversion succeeds, so the failure appears tied to the temporary LibreOffice profile invocation used by the renderer.
Environment
- OS: Windows 10 Home
- Codex CLI:
codex-cli 0.130.0-alpha.5 - Codex Desktop App on Windows
- Documents plugin bundle/version:
openai-primary-runtime/documents/26.521.10419 - LibreOffice:
26.2.3.2 - Poppler /
pdftoppm: installed and usable
Observed behavior
Running the Documents skill renderer against a simple generated DOCX fails before producing the intermediate PDF/PNGs:
RuntimeError: Failed to produce PDF for rasterization (direct and ODT fallback).
--- DOCX->PDF ---
CMD: soffice -env:UserInstallation=file://C:\Users\<USER>\AppData\Local\Temp\soffice_profile_xxx --invisible --headless --norestore --convert-to pdf --outdir C:\Users\<USER>\AppData\Local\Temp\soffice_convert_xxx C:\path\to\render-test.docx
EXIT: 1
STDERR:
libpng error: Write Error
--- DOCX->ODT ---
CMD: soffice -env:UserInstallation=file://C:\Users\<USER>\AppData\Local\Temp\soffice_profile_xxx --invisible --headless --norestore --convert-to odt --outdir C:\Users\<USER>\AppData\Local\Temp\soffice_convert_xxx C:\path\to\render-test.docx
EXIT: 1
STDERR:
libpng error: Write Error
The same error persisted after:
- MSI repair via
msiexec.exe /fa {product-code} winget install --id TheDocumentFoundation.LibreOffice -e --silent --force
Expected behavior
render_docx.py should successfully render a DOCX to page PNGs on Windows when LibreOffice and Poppler are installed, or should generate a Windows-compatible LibreOffice UserInstallation URI.
Reproduction outline
- On Windows, create a simple DOCX, e.g. a heading and one paragraph.
- Run the Documents plugin renderer:
python render_docx.py C:\path\to\render-test.docx --output_dir C:\path\to\rendered --emit_pdf
- Observe the failure above.
Additional evidence
Direct LibreOffice conversion works for the same file:
& 'C:\Program Files\LibreOffice\program\soffice.exe' --headless --convert-to pdf --outdir C:\path\to\out C:\path\to\render-test.docx
The PDF is produced successfully.
Poppler PDF-to-PNG conversion also works:
pdftoppm -png C:\path\to\render-test.pdf C:\path\to\page
The PNG is produced successfully.
This provides a viable workaround:
DOCX -> LibreOffice direct PDF export -> pdftoppm PNG rasterization
Suspected cause
render_docx.py appears to build the LibreOffice profile argument by concatenating:
-env:UserInstallation=file:// + user_profile
On Windows this produces a value like:
file://C:\Users\<USER>\AppData\Local\Temp\soffice_profile_xxx
That may not be a valid/stable file URI for LibreOffice on Windows. A more Windows-compatible URI would likely be closer to:
file:///C:/Users/<USER>/AppData/Local/Temp/soffice_profile_xxx
Using pathlib.Path(user_profile).as_uri() or equivalent URI normalization may be safer.
Notes
No customer documents were used for this report. The failure was reproduced with a trivial test DOCX.
This issue has 5 comments on GitHub. Read the full discussion on GitHub ↗