Hello! I am facing this error:
[2025-11-12 15:20:46] production.ERROR: Failed to convert document to PDF: Failed to convert document to PDF: Unsupported MIME type for extension:
{"userId":"ada321ba-ac56-424c-84e1-13ff8bc2c1cb","exception":
"[object] (Mateffy\\Magic\\Exceptions\\ArtifactGenerationFailed(code: 0): Failed to convert document to PDF: Failed to convert document to PDF: Unsupported MIME type for extension: at
/app/vendor/mateffy/llm-magic/src/Magic/Extraction/Artifacts/DiskArtifact.php:308)
I checked the document and it´s normal.
Context Info:
- OS Host: Windows
- Image: mateffy/data-wizard:latest
- LibreOffice: 7.4.7.2 40(Build:2) (alredy on the image)
- Docker Compose
Possible Cause
I identified that LibreOffice operate as root and fail as www-data
root - WORKS ✓
root@container:/app# libreoffice --headless --convert-to pdf --outdir /tmp /path/to/file.docx convert /path/to/file.docx -> /tmp/file.pdf using writer_pdf_Export
www-data - FAIL ✗
root@container:/app# su -s /bin/bash www-data -c "libreoffice --headless --convert-to pdf --outdir /tmp /path/to/file.docx" javaldx failed! Warning: failed to read path from javaldx LibreOffice 7.4 - Fatal Error: The application cannot be started. LibreOffice user installation could not be processed due to missing access rights. Please make sure that you have sufficient access rights for the following location and restart LibreOffice: /config/libreoffice/4
I found this variables here:
XDG_CONFIG_HOME=/config
XDG_DATA_HOME=/data
HOME=/root
The problem is: LibreOffice try to use /config/libreoffice/4 (by XDG_CONFIG_HOME), but this directory belongs to root:root and www-data do not have write permissions.
ls -la /config
root@container:/app
drwxr-xr-x 6 root root 4096 Nov 12 16:05 .
drwxr-xr-x 2 root root 4096 Nov 12 15:59 caddy
drwxr-xr-x 2 root root 4096 Nov 12 15:59 composer
drwxr-xr-x 3 root root 4096 Nov 12 16:05 libreoffice
I Tried
RUN mkdir -p /var/www/.config /var/www/.cache && \
chown -R www-data:www-data /var/www
But LibreOffice ignores it and use /config.
RUN mkdir -p /config/libreoffice && \
chown -R www-data:www-data /config/libreoffice
But fail: /config/libreoffice do not exists in the base image.
su -s /bin/bash www-data -c "XDG_CONFIG_HOME=/var/www/.config libreoffice --headless --convert-to pdf ..."
But the primal error remains.
RUN sed -i 's/\[supervisord\]/[supervisord]\nuser=www-data/' /etc/supervisor/conf.d/*.conf
docker-compose.yml Configuration:
services:
data-wizard:
container_name: data-wizard
image: mateffy/data-wizard:latest
ports:
- "9090:80"
- "4430:443"
- "4430:443/udp"
volumes:
- data_wizard_storage:/app/storage
- data_wizard_sqlite_data:/app/database
- data_wizard_caddy_data:/data
- data_wizard_caddy_config:/config
environment:
- APP_KEY=${APP_KEY}
restart: unless-stopped
Be Aware: The Problem Can Be Me
Yes. I do not have much experience with Docker, so I may have made mistakes somewhere. If you identify anything like that, please let me know.
Hello! I am facing this error:
I checked the document and it´s normal.
Context Info:
Possible Cause
I identified that LibreOffice operate as root and fail as www-data
root - WORKS ✓
root@container:/app# libreoffice --headless --convert-to pdf --outdir /tmp /path/to/file.docx convert /path/to/file.docx -> /tmp/file.pdf using writer_pdf_Exportwww-data - FAIL ✗
root@container:/app# su -s /bin/bash www-data -c "libreoffice --headless --convert-to pdf --outdir /tmp /path/to/file.docx" javaldx failed! Warning: failed to read path from javaldx LibreOffice 7.4 - Fatal Error: The application cannot be started. LibreOffice user installation could not be processed due to missing access rights. Please make sure that you have sufficient access rights for the following location and restart LibreOffice: /config/libreoffice/4I found this variables here:
The problem is: LibreOffice try to use
/config/libreoffice/4(by XDG_CONFIG_HOME), but this directory belongs toroot:rootand www-data do not have write permissions.ls -la /config
I Tried
/var/www/.configwith permission for www-dataBut LibreOffice ignores it and use
/config./config/libreofficeBut fail:
/config/libreofficedo not exists in the base image.But the primal error remains.
docker-compose.yml Configuration:
Be Aware: The Problem Can Be Me