{"record":{"id":"3525d5958f6d5786","repo":"deepset-ai/haystack","slug":"input-mapping-must-be-a-dictionary","errorCode":null,"errorMessage":"input_mapping must be a dictionary","messagePattern":"input_mapping must be a dictionary","errorType":"exception","errorClass":"InvalidMappingTypeError","httpStatus":null,"severity":"error","filePath":"haystack/core/super_component/super_component.py","lineNumber":196,"sourceCode":"        if socket_name is None:\n            raise InvalidMappingValueError(f\"Invalid path format: '{path}'. Expected 'component_name.socket_name'.\")\n        return comp_name, socket_name\n\n    def _validate_input_mapping(\n        self, pipeline_inputs: dict[str, dict[str, Any]], input_mapping: dict[str, list[str]]\n    ) -> None:\n        \"\"\"\n        Validates the input mapping to ensure that specified components and sockets exist in the pipeline.\n\n        :param pipeline_inputs: A dictionary containing pipeline input specifications.\n        :param input_mapping: A dictionary mapping wrapper input names to pipeline socket paths.\n        :raises InvalidMappingTypeError:\n            If the input mapping is of invalid type or contains invalid types.\n        :raises InvalidMappingValueError:\n            If the input mapping contains nonexistent components or sockets.\n        \"\"\"\n        if not isinstance(input_mapping, dict):\n            raise InvalidMappingTypeError(\"input_mapping must be a dictionary\")\n\n        for wrapper_input_name, pipeline_input_paths in input_mapping.items():\n            if not isinstance(pipeline_input_paths, list):\n                raise InvalidMappingTypeError(f\"Input paths for '{wrapper_input_name}' must be a list of strings.\")\n            for path in pipeline_input_paths:\n                comp_name, socket_name = self._split_component_path(path)\n                if comp_name not in pipeline_inputs:\n                    raise InvalidMappingValueError(\n                        f\"Component '{comp_name}' not found in pipeline inputs.\\n\"\n                        f\"Available components: {list(pipeline_inputs.keys())}\"\n                    )\n                if socket_name not in pipeline_inputs[comp_name]:\n                    raise InvalidMappingValueError(\n                        f\"Input socket '{socket_name}' not found in component '{comp_name}'.\\n\"\n                        f\"Available inputs for '{comp_name}': {list(pipeline_inputs[comp_name].keys())}\"\n                    )\n\n    def _resolve_input_types_from_mapping(","sourceCodeStart":178,"sourceCodeEnd":214,"githubUrl":"https://github.com/deepset-ai/haystack/blob/e318778c9bf60a1963e3b5f451359655dd696c30/haystack/core/super_component/super_component.py#L178-L214","documentation":"input_mapping must be a dict mapping wrapper input names to lists of pipeline paths. Passing any other type raises InvalidMappingTypeError.","triggerScenarios":"SuperComponent(pipeline=..., input_mapping=[...]) or input_mapping=None-as-list/set/string instead of a dict.","commonSituations":"Passing a list of tuples instead of a dict; JSON config decoded into the wrong shape; forgetting input_mapping entirely while passing it positionally wrong.","solutions":["Wrap the mapping in a dict: {\"wrapper_input\": [\"component.socket\"]}","Fix config loading so the JSON/YAML section is parsed as an object, not an array"],"exampleFix":"// before\ninput_mapping = [(\"text\", \"embedder.text\")]\n// after\ninput_mapping = {\"text\": [\"embedder.text\"]}","handlingStrategy":"validation","validationCode":"def ensure_input_mapping_shape(input_mapping):\n    if not isinstance(input_mapping, dict):\n        raise TypeError(\"input_mapping must be a dict of {name: [\"component.socket\", ...]}\")\n    return input_mapping","typeGuard":"from typing import Any\ndef is_valid_input_mapping(v: Any) -> bool:\n    return isinstance(v, dict) and all(isinstance(k, str) and isinstance(l, list) for k, l in v.items())","tryCatchPattern":"from haystack.core.errors import InvalidMappingTypeError\ntry:\n    super_comp = SuperComponent(pipeline=pipe, input_mapping=input_mapping)\nexcept InvalidMappingTypeError as e:\n    if str(e) == \"input_mapping must be a dictionary\":\n        input_mapping = dict(input_mapping)  # e.g. from list of pairs\n        super_comp = SuperComponent(pipeline=pipe, input_mapping=input_mapping)\n    else:\n        raise","preventionTips":["Always define input_mapping as a dict literal","Validate external config files parse mappings into dicts","Keep a typed helper/TypedDict for mapping shapes in your project"],"tags":["super-component","input-mapping","type-validation"],"backgroundTag":"invalid-mapping-type","analyzedSha":"e318778c9bf60a1963e3b5f451359655dd696c30","analyzedAt":"2026-08-30T11:45:20.711Z","schemaVersion":2},"datasetVersion":"2026-08-30T13:17:10.514Z"}