{"record":{"id":"b283c3f552794ed7","repo":"deepset-ai/haystack","slug":"error-loading-pipeline-from-yaml-ensure-that-all","errorCode":null,"errorMessage":"Error loading pipeline from YAML - Ensure that all pipeline components only serialize basic Python types","messagePattern":"Error loading pipeline from YAML - Ensure that all pipeline components only serialize basic Python types","errorType":"exception","errorClass":"TypeError","httpStatus":null,"severity":"error","filePath":"haystack/marshal/yaml.py","lineNumber":42,"sourceCode":"YamlLoader.add_constructor(\"tag:yaml.org,2002:python/tuple\", YamlLoader.construct_python_tuple)\n\n\nclass YamlMarshaller:\n    def marshal(self, dict_: dict[str, Any]) -> str:\n        \"\"\"Return a YAML representation of the given dictionary.\"\"\"\n        try:\n            return yaml.dump(dict_, Dumper=YamlDumper)\n        except yaml.representer.RepresenterError as e:\n            raise TypeError(\n                \"Error dumping pipeline to YAML - Ensure that all pipeline components only serialize basic Python types\"\n            ) from e\n\n    def unmarshal(self, data_: str | bytes | bytearray) -> dict[str, Any]:\n        \"\"\"Return a dictionary from the given YAML data.\"\"\"\n        try:\n            return yaml.load(data_, Loader=YamlLoader)\n        except yaml.constructor.ConstructorError as e:\n            raise TypeError(\n                \"Error loading pipeline from YAML - Ensure that all pipeline \"\n                \"components only serialize basic Python types\"\n            ) from e\n","sourceCodeStart":24,"sourceCodeEnd":46,"githubUrl":"https://github.com/deepset-ai/haystack/blob/e318778c9bf60a1963e3b5f451359655dd696c30/haystack/marshal/yaml.py#L24-L46","documentation":"YamlMarshaller.unmarshal loads YAML back into a dictionary; the YAML must only use constructor tags for basic types. If the YAML contains unknown or unsafe python-specific tags (from another marshaller/version or hand-editing), yaml raises ConstructorError, re-raised as a TypeError with guidance about basic Python types.","triggerScenarios":"Calling unmarshal (or pipeline loads) on YAML containing tags YamlLoader cannot construct — e.g. `!!python/object` tags, custom tags emitted by other tools, or corrupted/hand-edited pipeline YAML.","commonSituations":"Loading YAML produced by a different haystack version or a JSON/YAML dump with custom tags; manually edited pipeline files with stray tags; cross-framework marshalled content pasted into haystack YAML.","solutions":["Regenerate the YAML with the same haystack pipeline's dumps/marshal so it uses supported tags","Remove or replace unsupported tags in the YAML with plain basic-type values","Confirm you are loading YAML (not JSON/marshalled bytes from another marshaller) with the matching loader"],"exampleFix":"// before\ncomponents:\n  cleaner: !!python/object:pipeline.Cleaner {x: 1}  # unsupported tag\n// after\ncomponents:\n  cleaner:\n    type: pipeline.Cleaner\n    init_parameters: {x: 1}","handlingStrategy":"try-catch","validationCode":"import yaml\nclass NoUnknownTags(yaml.SafeLoader): pass\ndef check_yaml_tags(data):\n    list(yaml.compose(data, Loader=NoUnknownTags))  # raises on unsupported tags","typeGuard":null,"tryCatchPattern":"try:\n    d = marshaller.unmarshal(data)\nexcept TypeError as e:\n    if \"loading pipeline from YAML\" in str(e):\n        d = marshaller.unmarshal(regenerate_yaml(data))  # re-dump with supported tags\n    else:\n        raise","preventionTips":["Only load YAML produced by the same haystack version's dumps/marshal","Never paste YAML containing !!python/ or custom tags into pipeline files","Validate YAML round-trips after manual edits"],"tags":["python","yaml","serialization","pipeline"],"backgroundTag":"yaml-serialization-failed","analyzedSha":"e318778c9bf60a1963e3b5f451359655dd696c30","analyzedAt":"2026-08-30T11:45:20.711Z","schemaVersion":2},"datasetVersion":"2026-08-30T13:17:10.514Z"}