{"record":{"id":"1d5cc1e38ca4c8c3","repo":"zylon-ai/private-gpt","slug":"text-reader-dependencies-are-not-installed","errorCode":null,"errorMessage":"Text reader dependencies are not installed.","messagePattern":"Text reader dependencies are not installed\\.","errorType":"exception","errorClass":"ImportError","httpStatus":null,"severity":"error","filePath":"private_gpt/components/readers/factories/text.py","lineNumber":55,"sourceCode":"            HtmlReader,\n        )\n    except ImportError as e:\n        raise ImportError(\n            format_missing_dependency_message(\n                \"HTML reader\",\n                extras=\"ingest-markup\",\n            )\n        ) from e\n    return HtmlReader()\n\n\ndef _text_reader() -> IngestionReader:\n    try:\n        from private_gpt.components.readers.text.text_reader import (\n            TextReader,\n        )\n    except ImportError as e:\n        raise ImportError(\n            format_missing_dependency_message(\n                \"Text reader\",\n            )\n        ) from e\n    return TextReader()\n\n\n_EXTENSION_READERS = {\n    \".csv\": _delimiter_reader,\n    \".tsv\": _delimiter_reader,\n    \".psv\": _delimiter_reader,\n    \".eml\": _email_reader,\n    \".html\": _html_reader,\n    \".htm\": _html_reader,\n    \".xhtml\": _html_reader,\n    \".xht\": _html_reader,\n    \".shtml\": _html_reader,\n    \".shtm\": _html_reader,","sourceCodeStart":37,"sourceCodeEnd":73,"githubUrl":"https://github.com/zylon-ai/private-gpt/blob/4a030776a31a901ad80b1bf4d7faa2c1a367efbb/private_gpt/components/readers/factories/text.py#L37-L73","documentation":"Raised by the text reader factory when the lazily-imported private_gpt.components.readers.text.text_reader.TextReader module cannot be imported, i.e. the optional dependencies that back the plain-text ingestion path are missing from the environment. The factory catches the ImportError and re-raises it wrapped with a formatted 'missing dependency' message so the caller knows which optional extra to install rather than seeing a raw ModuleNotFoundError. It is an installation/packaging problem, not a runtime data problem.","triggerScenarios":"Calling get_reader_by_extension('.txt') (or any extension mapped to _text_reader in _EXTENSION_READERS) in an environment where the text-reader extra was never installed, so `from private_gpt.components.readers.text.text_reader import TextReader` raises ImportError.","commonSituations":"Installing private-gpt with a minimal extras set (e.g. only ingest-markup) and then ingesting a .txt/.md file; a fresh venv built from a slim requirements list; CI images that prune optional ingestion dependencies; version upgrades where the text reader moved behind an extra.","solutions":["Install the text-ingestion extra for private-gpt (e.g. `pip install -e '.[ingest-text]'` or the extra name shown in format_missing_dependency_message output).","Verify the import now resolves: `python -c \"from private_gpt.components.readers.text.text_reader import TextReader\"`.","If you do not need text ingestion, avoid routing .txt/.md files to the text reader (check _EXTENSION_READERS mappings) or register a fallback reader for those extensions.","If the extra is installed but the error persists, check for a conflicting package version causing the inner ImportError (inspect the chained `__cause__`)."],"exampleFix":"# before\nreader = component.get_reader_by_extension(\".txt\")  # ImportError: Text reader dependencies are not installed.\n\n# after\n# shell: pip install -e '.[ingest-text]'\nreader = component.get_reader_by_extension(\".txt\")  # ok","handlingStrategy":"validation","validationCode":"def text_reader_available() -> bool:\n    try:\n        from private_gpt.components.readers.text.text_reader import TextReader  # noqa: F401\n        return True\n    except ImportError:\n        return False\n\nif not text_reader_available():\n    raise SystemExit(\"Install the text ingestion extra before ingesting .txt files\")","typeGuard":null,"tryCatchPattern":"try:\n    reader = component.get_reader_by_extension(\".txt\")\nexcept ImportError as e:\n    logger.error(\"Missing optional dependency: %s\", e)\n    raise","preventionTips":["Pin and install all ingestion extras your file types require in the deployment image.","Add a startup probe that imports each optional reader your config enables.","Document which extensions require which extras next to your ingestion config."],"tags":["dependencies","import","ingestion","text-reader","optional-extras"],"backgroundTag":null,"analyzedSha":"4a030776a31a901ad80b1bf4d7faa2c1a367efbb","analyzedAt":"2026-08-15T03:51:26.951Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}