{"record":{"id":"51dbbb1bde12d59b","repo":"docling-project/docling","slug":"no-class-found-with-the-name-kind-r-known-class","errorCode":null,"errorMessage":"No class found with the name {kind!r}, known classes are:\n{msg_str}","messagePattern":"No class found with the name (.+?), known classes are:\n(.+?)","errorType":"exception","errorClass":"RuntimeError","httpStatus":null,"severity":"error","filePath":"docling/models/factories/base_factory.py","lineNumber":59,"sourceCode":"            names={kind: kind for kind in self.registered_kind},\n            type=str,\n            module=__name__,\n        )\n\n    @property\n    def classes(self):\n        return self._classes\n\n    @property\n    def registered_meta(self):\n        return self._meta\n\n    def create_instance(self, options: BaseOptions, **kwargs) -> A:\n        try:\n            _cls = self._classes[type(options)]\n            return _cls(options=options, **kwargs)\n        except KeyError:\n            raise RuntimeError(self._err_msg_on_class_not_found(options.kind))\n\n    def create_options(self, kind: str, *args, **kwargs) -> BaseOptions:\n        for opt_cls, _ in self._classes.items():\n            if opt_cls.kind == kind:\n                return opt_cls(*args, **kwargs)\n        raise RuntimeError(self._err_msg_on_class_not_found(kind))\n\n    def _err_msg_on_class_not_found(self, kind: str):\n        msg = []\n\n        for opt, cls in self._classes.items():\n            msg.append(f\"\\t{opt.kind!r} => {cls!r}\")\n\n        msg_str = \"\\n\".join(msg)\n\n        return f\"No class found with the name {kind!r}, known classes are:\\n{msg_str}\"\n\n    def register(self, cls: Type[A], plugin_name: str, plugin_module_name: str):","sourceCodeStart":41,"sourceCodeEnd":77,"githubUrl":"https://github.com/docling-project/docling/blob/61d76f1ff3f8428065465889f7b4577da7df704c/docling/models/factories/base_factory.py#L41-L77","documentation":"Raised as RuntimeError by BaseFactory.create_instance when the concrete options type passed to the factory has no registered implementation class. The factory maps options classes to model classes; a KeyError on type(options) means no plugin providing that options class was ever registered in this process.","triggerScenarios":"Calling create_instance(options) where type(options) was never registered via factory.register() or discovered by load_from_plugins(). Typical when the plugin package that defines the model implementation was never imported or installed.","commonSituations":"Using a third-party Docling model plugin without importing its module (registration usually happens at import time); plugin discovery disabled or restricted (allow_external_plugins=False); plugin package missing from the environment.","solutions":["Import the plugin module that registers the model class before creating the instance.","Install the plugin package (e.g. uv add / pip install the plugin) so its entry point or import side effect runs.","Check factory.registered_meta / classes to confirm which kinds are actually available, and enable plugin loading (load_from_plugins) if the plugin ships via entry points."],"exampleFix":"# before\noptions = MyModelOptions(...)  # from a plugin\nmodel = factory.create_instance(options)  # RuntimeError\n\n# after\nimport my_docling_plugin  # registers the class on import\nmodel = factory.create_instance(options)","handlingStrategy":"validation","validationCode":"factory = MyFactory.getInstance()\nif type(options) not in factory.classes:\n    raise SystemExit(\n        f'{type(options).__name__} not registered; known kinds: '\n        + ', '.join(opt.kind for opt in factory.classes)\n    )","typeGuard":"def is_registered(factory, options) -> bool:\n    return type(options) in factory.classes","tryCatchPattern":"try:\n    model = factory.create_instance(options)\nexcept RuntimeError as e:\n    if 'No class found' in str(e):\n        import my_docling_plugin  # noqa: F401 ensure registration\n        model = factory.create_instance(options)\n    else:\n        raise","preventionTips":["Import plugin modules once at application startup, before any factory use.","Print factory.registered_meta during onboarding to confirm plugin discovery.","Pin plugin versions so registration side effects cannot silently disappear."],"tags":["factory","plugins","runtime-error","registration"],"backgroundTag":null,"analyzedSha":"61d76f1ff3f8428065465889f7b4577da7df704c","analyzedAt":"2026-08-14T23:53:18.727Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}