deepset-ai/haystack · error · PipelineError
Successfully imported module '{module}' but couldn't find '{
Error message
Successfully imported module '{module}' but couldn't find '{component_type}' in the component registry.
The component might be registered under a different path. Here are the registered components:
{list(component.registry.keys())}
What it means
When a serialized component's 'type' is a dotted path not yet in the registry, Haystack imports the module and re-checks the registry. If the class is still absent, it raises PipelineError listing all registered components, meaning the path doesn't match any registered component key.
Source
Thrown at haystack/core/pipeline/base.py:249
# Reuse an instance
instance = components_to_reuse[name]
else:
if "type" not in component_data:
raise PipelineError(f"Missing 'type' in component '{name}'")
component_type = component_data["type"]
if isinstance(component_type, str) and "." in component_type:
_check_module_allowed(component_type.rsplit(".", 1)[0])
if component_type not in component.registry:
try:
# Import the module first...
module, _ = component_type.rsplit(".", 1)
logger.debug("Trying to import module {module_name}", module_name=module)
type_serialization.thread_safe_import(module)
# ...then try again
if component_type not in component.registry:
raise PipelineError( # noqa: TRY301
f"Successfully imported module '{module}' but couldn't find "
f"'{component_type}' in the component registry.\n"
f"The component might be registered under a different path. "
f"Here are the registered components:\n {list(component.registry.keys())}\n"
)
except (ImportError, PipelineError, ValueError) as e:
raise PipelineError(
f"Component '{component_type}' (name: '{name}') not imported. Please "
f"check that the package is installed and the component path is correct."
) from e
# Create a new one
component_class = component.registry[component_type]
try:
instance = component_from_dict(component_class, component_data, name, callbacks)
except Exception as e:
# Convert to JSON with indentation, truncate if too longView on GitHub (pinned to e318778c9b)
Solutions
- Fix the 'type' string in the pipeline definition to the exact registry key of the component
- Ensure the component class is decorated with @component so it registers on import
- Run component.registry keys (printed in the error) and copy the exact path
- Avoid duplicate haystack installs in the environment (pip check / single venv)
Example fix
// before
# type: my_custom_components.Ranker (class has no @component)
// after
@component
class Ranker: # in module my_custom_components
...
# and in yaml: type: my_custom_components.Ranker Defensive patterns
Strategy: validation
Validate before calling
import haystack.core.component as hc
def check_types_registered(data: dict) -> list[str]:
missing = []
for name, comp in data.get("components", {}).items():
t = comp.get("type")
if t and t not in hc.component.registry:
try:
module, _ = t.rsplit(".", 1)
__import__(module)
except Exception as e:
missing.append(f"{name}: cannot import {t}: {e}")
return missing Type guard
def is_registered(component_type: str) -> bool:
from haystack.core.component import component
return component_type in component.registry Try / catch
try:
pipe = Pipeline.from_dict(data)
except PipelineError as e:
if "couldn't find" in str(e):
logging.error("Fix the component path or register the component: %s", e) Prevention
- Decorate custom classes with @component so they self-register on import
- Import the module containing custom components before from_dict
- Compare 'type' strings against the registry keys printed in the error
- Keep a single haystack install per environment
When it happens
Trigger: from_dict on a pipeline whose component 'type' points to a class that imports fine but never registered itself — wrong class name, custom component file imported but @component never applied, or the registry key differs from the string used.
Common situations: Renaming a custom component class but keeping the old type string in YAML; using a fully-qualified path to a class without the @component decorator; extra haystack-core-haystack duplicate installs where one copy registers but the other is imported.
Related errors
- Component '{component_type}' (name: '{name}') not imported.
- Missing 'type' in component '{name}'
- Couldn't deserialize component '{name}' of class '{component
- Missing sender in connection: {connection}
- Missing receiver in connection: {connection}
AI-assisted analysis of deepset-ai/haystack@e318778c9b (2026-08-30).
Data as JSON: /api/errors/e5cfa9905193059a.
Report an issue: GitHub.