{"record":{"id":"89880fc740fb2c0d","repo":"zylon-ai/private-gpt","slug":"invalid-request-error-89880f","errorCode":"INVALID_REQUEST_ERROR","errorMessage":"LibreOffice is required for file conversion. Please install LibreOffice.","messagePattern":"LibreOffice is required for file conversion\\. Please install LibreOffice\\.","errorType":"exception","errorClass":"ImportError","httpStatus":400,"severity":"error","filePath":"private_gpt/components/ingest/utils.py","lineNumber":444,"sourceCode":"def convert_file_with_libreoffice(\n    file_info: FileInfo, target_extension: str, raise_in_exception: bool = False\n) -> Path:\n    output_path = file_info.file_data.with_suffix(target_extension)\n    try:\n        subprocess.run(\n            [\n                \"soffice\",\n                \"--headless\",\n                \"--convert-to\",\n                target_extension.lstrip(\".\"),\n                \"--outdir\",\n                str(output_path.parent),\n                str(file_info.file_data),\n            ],\n            check=True,\n        )\n    except FileNotFoundError as e:\n        raise ImportError(\n            \"LibreOffice is required for file conversion. Please install LibreOffice.\"\n        ) from e\n    except subprocess.CalledProcessError as e:\n        if raise_in_exception:\n            raise RuntimeError(\n                f\"Failed to convert {file_info.file_data} to {target_extension}: {e}\"\n            ) from e\n        return file_info.file_data  # Return the original file on failure\n    return output_path\n\n\ndef convert_file(\n    file_info: FileInfo,\n    conversion_func: Callable[[FileInfo, str, bool], Path],\n    target_extension: str,\n    raise_in_exception: bool = False,\n) -> FileInfo:\n    try:","sourceCodeStart":426,"sourceCodeEnd":462,"githubUrl":"https://github.com/zylon-ai/private-gpt/blob/4a030776a31a901ad80b1bf4d7faa2c1a367efbb/private_gpt/components/ingest/utils.py#L426-L462","documentation":"ImportError raised by convert_file_with_libreoffice when subprocess.run(['soffice', ...]) raises FileNotFoundError — the LibreOffice executable is not installed or not on PATH. The message tells you explicitly to install LibreOffice; tagged INVALID_REQUEST_ERROR at the API layer.","triggerScenarios":"Ingesting a legacy Office file (.xls/.doc/.ppt) or any format routed through convert_unsupported_file / fallback conversion when 'soffice' is missing from PATH in the server/worker container.","commonSituations":"Slim Docker images without LibreOffice; CI environments; deploying to a host where LibreOffice was never installed; PATH not including /usr/bin in the service unit.","solutions":["Install LibreOffice in the environment running ingestion: 'apt-get install -y libreoffice' (Debian/Ubuntu) or add libreoffice to the Docker image.","Verify with 'soffice --version' from the same shell/user the service runs as.","If a full install is too heavy, install libreoffice-core + the specific format filters.","Alternatively pre-convert .xls/.doc/.ppt files to modern formats upstream so LibreOffice is never needed."],"exampleFix":"# Dockerfile\n# before\nFROM python:3.12-slim\n\n# after\nFROM python:3.12-slim\nRUN apt-get update && apt-get install -y --no-install-recommends libreoffice && rm -rf /var/lib/apt/lists/*","handlingStrategy":"validation","validationCode":"import shutil\nif shutil.which('soffice') is None:\n    raise RuntimeError('LibreOffice (soffice) not found on PATH; install it before ingesting legacy Office files')","typeGuard":null,"tryCatchPattern":"try:\n    converted = convert_unsupported_file(file_info)\nexcept ImportError as e:\n    if 'LibreOffice' in str(e):\n        return api_error(503, 'Legacy format conversion unavailable: LibreOffice not installed')","preventionTips":["Include a 'soffice --version' check in container health checks / CI.","Bake LibreOffice into the ingest worker image rather than relying on host installs."],"tags":["ingestion","libreoffice","dependencies","conversion"],"backgroundTag":null,"analyzedSha":"4a030776a31a901ad80b1bf4d7faa2c1a367efbb","analyzedAt":"2026-08-15T03:51:26.951Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}