docling-project/docling · error · RuntimeError
No class found with the name {kind!r}, known classes are: {m
Error message
No class found with the name {kind!r}, known classes are:
{msg_str} What it means
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.
Source
Thrown at docling/models/factories/base_factory.py:59
names={kind: kind for kind in self.registered_kind},
type=str,
module=__name__,
)
@property
def classes(self):
return self._classes
@property
def registered_meta(self):
return self._meta
def create_instance(self, options: BaseOptions, **kwargs) -> A:
try:
_cls = self._classes[type(options)]
return _cls(options=options, **kwargs)
except KeyError:
raise RuntimeError(self._err_msg_on_class_not_found(options.kind))
def create_options(self, kind: str, *args, **kwargs) -> BaseOptions:
for opt_cls, _ in self._classes.items():
if opt_cls.kind == kind:
return opt_cls(*args, **kwargs)
raise RuntimeError(self._err_msg_on_class_not_found(kind))
def _err_msg_on_class_not_found(self, kind: str):
msg = []
for opt, cls in self._classes.items():
msg.append(f"\t{opt.kind!r} => {cls!r}")
msg_str = "\n".join(msg)
return f"No class found with the name {kind!r}, known classes are:\n{msg_str}"
def register(self, cls: Type[A], plugin_name: str, plugin_module_name: str):View on GitHub (pinned to 61d76f1ff3)
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.
Example fix
# before options = MyModelOptions(...) # from a plugin model = factory.create_instance(options) # RuntimeError # after import my_docling_plugin # registers the class on import model = factory.create_instance(options)
Defensive patterns
Strategy: validation
Validate before calling
factory = MyFactory.getInstance()
if type(options) not in factory.classes:
raise SystemExit(
f'{type(options).__name__} not registered; known kinds: '
+ ', '.join(opt.kind for opt in factory.classes)
) Type guard
def is_registered(factory, options) -> bool:
return type(options) in factory.classes Try / catch
try:
model = factory.create_instance(options)
except RuntimeError as e:
if 'No class found' in str(e):
import my_docling_plugin # noqa: F401 ensure registration
model = factory.create_instance(options)
else:
raise Prevention
- 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.
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- {opt_type.kind!r} already registered to class {self._classes
- Failed to convert doc (hash={self.document_hash}, name={self
- No default options configured for {format}
- gRPC metadata call failed for model {self.model_name}: {exc}
- Expected OnnxRuntimeImageClassificationEngineOptions, got {t
AI-assisted analysis of docling-project/docling@61d76f1ff3 (2026-08-14).
Data as JSON: /api/errors/51dbbb1bde12d59b.
Report an issue: GitHub.