{"record":{"id":"9203b383dc2c4cef","repo":"deepset-ai/haystack","slug":"missing-type-in-component-name","errorCode":null,"errorMessage":"Missing 'type' in component '{name}'","messagePattern":"Missing 'type' in component '(.+?)'","errorType":"exception","errorClass":"PipelineError","httpStatus":null,"severity":"error","filePath":"haystack/core/pipeline/base.py","lineNumber":235,"sourceCode":"        cls: type[T], data: dict[str, Any], callbacks: DeserializationCallbacks | None = None, **kwargs: Any\n    ) -> T:\n        data_copy = _deepcopy_with_exceptions(data)  # to prevent modification of original data\n        metadata = data_copy.get(\"metadata\", {})\n        max_runs_per_component = data_copy.get(\"max_runs_per_component\", 100)\n        connection_type_validation = data_copy.get(\"connection_type_validation\", True)\n        pipe = cls(\n            metadata=metadata,\n            max_runs_per_component=max_runs_per_component,\n            connection_type_validation=connection_type_validation,\n        )\n        components_to_reuse = kwargs.get(\"components\", {})\n        for name, component_data in data_copy.get(\"components\", {}).items():\n            if name in components_to_reuse:\n                # Reuse an instance\n                instance = components_to_reuse[name]\n            else:\n                if \"type\" not in component_data:\n                    raise PipelineError(f\"Missing 'type' in component '{name}'\")\n\n                component_type = component_data[\"type\"]\n                if isinstance(component_type, str) and \".\" in component_type:\n                    _check_module_allowed(component_type.rsplit(\".\", 1)[0])\n\n                if component_type not in component.registry:\n                    try:\n                        # Import the module first...\n                        module, _ = component_type.rsplit(\".\", 1)\n                        logger.debug(\"Trying to import module {module_name}\", module_name=module)\n                        type_serialization.thread_safe_import(module)\n                        # ...then try again\n                        if component_type not in component.registry:\n                            raise PipelineError(  # noqa: TRY301\n                                f\"Successfully imported module '{module}' but couldn't find \"\n                                f\"'{component_type}' in the component registry.\\n\"\n                                f\"The component might be registered under a different path. \"\n                                f\"Here are the registered components:\\n {list(component.registry.keys())}\\n\"","sourceCodeStart":217,"sourceCodeEnd":253,"githubUrl":"https://github.com/deepset-ai/haystack/blob/e318778c9bf60a1963e3b5f451359655dd696c30/haystack/core/pipeline/base.py#L217-L253","documentation":"Pipeline.from_dict deserializes each entry under 'components'; every serialized component must declare its 'type' (the registry key). When the dict lacks 'type', Haystack cannot look the component up and raises PipelineError naming the offending component.","triggerScenarios":"Loading a YAML/JSON pipeline definition where a component entry in 'components' omits the 'type' key, e.g. components: {ranker: {init_parameters: {...}}} with no type field.","commonSituations":"Hand-editing YAML and deleting the type line; exporting tools producing incomplete YAML; template placeholders where 'type' is expected to be filled in but isn't; truncated or corrupted pipeline files.","solutions":["Add the missing 'type' key to the component entry, e.g. type: haystack.components.rankers.TransformersSimilarityRanker","Re-dump the pipeline with pipe.dumps()/yaml to regenerate a valid definition","Validate the YAML against a known-good pipeline file to spot omissions"],"exampleFix":"// before\ncomponents:\n  ranker:\n    init_parameters:\n      top_k: 10\n\n// after\ncomponents:\n  ranker:\n    type: haystack.components.rankers.TransformersSimilarityRanker\n    init_parameters:\n      top_k: 10","handlingStrategy":"validation","validationCode":"def validate_pipeline_yaml(data: dict) -> list[str]:\n    problems = []\n    for name, comp in data.get(\"components\", {}).items():\n        if \"type\" not in comp:\n            problems.append(f\"Component '{name}' is missing the 'type' key\")\n    return problems","typeGuard":null,"tryCatchPattern":"try:\n    pipe = Pipeline.from_dict(data)\nexcept PipelineError as e:\n    if \"Missing 'type'\" in str(e):\n        logging.error(\"Add the 'type' key to the component entry: %s\", e)","preventionTips":["Always generate pipeline YAML via pipe.dumps() rather than hand-writing it","Schema-check pipeline files in CI before loading","Never delete 'type' lines when editing serialized pipelines"],"tags":["serialization","yaml","pipeline","haystack"],"backgroundTag":"missing-required-field","analyzedSha":"e318778c9bf60a1963e3b5f451359655dd696c30","analyzedAt":"2026-08-30T11:45:20.711Z","schemaVersion":2},"datasetVersion":"2026-08-30T13:17:10.514Z"}