{"record":{"id":"d4bf5c8c7ea3d12a","repo":"deepset-ai/haystack","slug":"component-name-of-type-type-component-nam","errorCode":null,"errorMessage":"Component '{name}' of type '{type(component).__name__}' has an unsupported value of type '{type(v).__name__}' in the serialized data.","messagePattern":"Component '(.+?)' of type '(.+?)' has an unsupported value of type '(.+?)' in the serialized data\\.","errorType":"exception","errorClass":"SerializationError","httpStatus":null,"severity":"error","filePath":"haystack/core/serialization.py","lineNumber":100,"sourceCode":"                # In case the init parameter was not assigned, we use the default value\n                param_value = param.default\n            init_parameters[param_name] = param_value\n\n        data = default_to_dict(obj, **init_parameters)\n\n    _validate_component_to_dict_output(obj, name, data)\n    return data\n\n\ndef _validate_component_to_dict_output(component: Any, name: str, data: dict[str, Any]) -> None:\n    # Ensure that only basic Python types are used in the serde data.\n    def is_allowed_type(obj: Any) -> bool:\n        return isinstance(obj, (str, int, float, bool, list, dict, set, tuple, type(None)))\n\n    def check_iterable(iterable: Iterable[Any]) -> None:\n        for v in iterable:\n            if not is_allowed_type(v):\n                raise SerializationError(\n                    f\"Component '{name}' of type '{type(component).__name__}' has an unsupported value \"\n                    f\"of type '{type(v).__name__}' in the serialized data.\"\n                )\n            if isinstance(v, (list, set, tuple)):\n                check_iterable(v)\n            elif isinstance(v, dict):\n                check_dict(v)\n\n    def check_dict(d: dict[str, Any]) -> None:\n        if any(not isinstance(k, str) for k in d):\n            raise SerializationError(\n                f\"Component '{name}' of type '{type(component).__name__}' has a non-string key in the serialized data.\"\n            )\n\n        for k, v in d.items():\n            if not is_allowed_type(v):\n                raise SerializationError(\n                    f\"Component '{name}' of type '{type(component).__name__}' has an unsupported value \"","sourceCodeStart":82,"sourceCodeEnd":118,"githubUrl":"https://github.com/deepset-ai/haystack/blob/e318778c9bf60a1963e3b5f451359655dd696c30/haystack/core/serialization.py#L82-L118","documentation":"Haystack validates that a component's serialized output contains only JSON-safe primitive types (str, int, float, bool, list, dict, set, tuple, None) at every nesting level. This error is raised when a value inside a serialized structure (including nested lists) is of an unsupported type, such as a custom object, datetime, or bytes. It guards against silently producing data that cannot round-trip through JSON.","triggerScenarios":"Calling pipeline.dumps()/to_dict() when a component's to_dict() emits an unsupported object, e.g. a datetime, bytes, path object, or a custom class instance inside an init_parameters list, or a default_ color/context object leaked into serialized data.","commonSituations":"Custom components whose to_dict() passes through raw init parameters without converting them; third-party components that changed their serialized format; passing non-JSON values like numpy scalars or enum objects as pipeline component init args.","solutions":["Fix the component's to_dict() to serialize the offending value (e.g. convert datetime to ISO string, bytes to base64).","Convert the init parameter to a supported type before passing it to the component constructor.","Implement from_dict/to_dict pair that converts custom objects to dicts with a 'type' key so they deserialize correctly.","As a last resort wrap the value in a supported container only if the value is genuinely serializable; do not bypass validation."],"exampleFix":"// before\nclass MyComp(Component):\n    def to_dict(self):\n        return {\"type\": ..., \"init_parameters\": {\"start\": self.start}}  # start is a datetime\n\n// after\nclass MyComp(Component):\n    def to_dict(self):\n        return {\"type\": ..., \"init_parameters\": {\"start\": self.start.isoformat()}}","handlingStrategy":"validation","validationCode":"def validate_serializable(value, _depth=0):\n    if _depth > 32:\n        raise ValueError(\"structure too deep\")\n    allowed = (str, int, float, bool, list, dict, set, tuple, type(None))\n    if not isinstance(value, allowed):\n        raise ValueError(f\"unsupported type {type(value).__name__}\")\n    if isinstance(value, (list, set, tuple)):\n        for v in value: validate_serializable(v, _depth + 1)\n    elif isinstance(value, dict):\n        for k, v in value.items():\n            if not isinstance(k, str): raise ValueError(\"non-string key\")\n            validate_serializable(v, _depth + 1)\n    return True","typeGuard":"def is_serializable_value(v) -> bool:\n    return isinstance(v, (str, int, float, bool, list, dict, set, tuple, type(None)))","tryCatchPattern":"from haystack.core.errors import SerializationError\ntry:\n    yaml_str = pipeline.dumps()\nexcept SerializationError as e:\n    # parse the reported component and value type from e, fix its to_dict\n    print(\"Fix component serialization:\", e)","preventionTips":["Always pair custom Component to_dict with from_dict converting all init parameters to JSON-safe types","Never pass raw objects (datetime, bytes, numpy) as component init parameters","Run pipeline.dumps() in CI on every pipeline definition to catch serialization issues early","Prefer str/enum .value representations for non-primitive fields"],"tags":["serialization","python","haystack"],"backgroundTag":"unsupported-serialization-type","analyzedSha":"e318778c9bf60a1963e3b5f451359655dd696c30","analyzedAt":"2026-08-30T11:45:20.711Z","schemaVersion":2},"datasetVersion":"2026-08-30T13:17:10.514Z"}