{"record":{"id":"ba9054f373538a02","repo":"zylon-ai/private-gpt","slug":"unknown-docling-mode-docling-settings-mode","errorCode":null,"errorMessage":"Unknown Docling mode: {docling_settings.mode}","messagePattern":"Unknown Docling mode: (.+?)","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"private_gpt/components/readers/factories/docling.py","lineNumber":39,"sourceCode":"\n\n_PROVIDERS: dict[str, DoclingModeProvider] = {\n    \"api\": _create_docling_api_reader,\n}\n\n\ndef register_docling_mode(mode: str, provider: DoclingModeProvider) -> None:\n    _PROVIDERS[mode] = provider\n\n\nclass DoclingReaderFactory(ReaderFactory):\n    def create_reader(self, extension: str | None = None) -> IngestionReader:\n        del extension\n\n        docling_settings = self.settings.docling\n        provider = _PROVIDERS.get(docling_settings.mode)\n        if provider is None:\n            raise ValueError(f\"Unknown Docling mode: {docling_settings.mode}\")\n        return provider(self)\n","sourceCodeStart":21,"sourceCodeEnd":41,"githubUrl":"https://github.com/zylon-ai/private-gpt/blob/4a030776a31a901ad80b1bf4d7faa2c1a367efbb/private_gpt/components/readers/factories/docling.py#L21-L41","documentation":"Raised by DoclingReaderFactory.create_reader when settings.docling.mode has no registered provider in the module-level _PROVIDERS dict. The factory pattern allows pluggable Docling modes via register_docling_mode(); the stock registry contains only 'api' (DoclingApiReader). This error means the configured mode string does not match any registered provider — either a typo or a mode whose registering module was never imported.","triggerScenarios":"settings.docling.mode set to anything other than 'api' (the only built-in), or a custom mode registered via register_docling_mode() in a plugin/module that has not been imported when the factory runs. Fires when the reader registry builds the docling reader during ingestion startup.","commonSituations":"Configs from other Docling-integrating tools that use mode names like 'local' or 'remote' which private-gpt does not ship; a fork/plugin that previously registered a custom mode and the import was removed during upgrade; typo in settings.yaml.","solutions":["Set docling.mode: api in settings.yaml — it is the only mode private-gpt registers out of the box.","If you added a custom mode, ensure the module calling register_docling_mode('yourmode', provider) is imported before DoclingReaderFactory.create_reader runs (register at package import time).","Check for typos/whitespace in the mode value."],"exampleFix":"# plugin registering a custom mode — make sure this import happens at startup\nfrom private_gpt.components.readers.factories.docling import register_docling_mode\n\ndef _create_local_reader(factory):\n    from myapp.readers import LocalDoclingReader\n    return LocalDoclingReader()\n\nregister_docling_mode('local', _create_local_reader)","handlingStrategy":"type-guard","validationCode":"from private_gpt.components.readers.factories import docling as dl\n\ndef validate_docling_mode(mode: str) -> None:\n    if mode not in dl._PROVIDERS:\n        raise SystemExit(f\"docling.mode '{mode}' unknown; registered modes: {sorted(dl._PROVIDERS)}\")\n\nvalidate_docling_mode(settings().docling.mode)","typeGuard":"from private_gpt.components.readers.factories import docling as dl\n\ndef is_registered_docling_mode(mode: str) -> bool:\n    return mode in dl._PROVIDERS","tryCatchPattern":"try:\n    reader = factory.create_reader()\nexcept ValueError as e:\n    if \"Unknown Docling mode\" in str(e):\n        raise ConfigurationError(f\"set docling.mode to one of {sorted(dl._PROVIDERS)}\") from e\n    raise","preventionTips":["Stock installs: docling.mode is 'api' (the only registered provider) — do not copy mode values from other tools.","For custom modes, register via register_docling_mode() at import time of a module guaranteed to load before ingestion."],"tags":["docling","factory","configuration","plugin-registry"],"backgroundTag":null,"analyzedSha":"4a030776a31a901ad80b1bf4d7faa2c1a367efbb","analyzedAt":"2026-08-15T03:51:26.951Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}