{"record":{"id":"29c2069d0a4fc830","repo":"apache/beam","slug":"invalid-value-type-for-type-when-specifying-a-dict-for-type","errorCode":null,"errorMessage":"Invalid value \"{type}\" for \"type\". When specifying a dict for type, it must follow this format: {\"outer\": [list of inputs to outer join]}. Example: {\"outer\": [\"input1\", \"input2\"]}","messagePattern":"Invalid value \"(.+?)\" for \"type\"\\. When specifying a dict for type, it must follow this format: (.+?)\\. Example: (.+?)","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"sdks/python/apache_beam/yaml/yaml_join.py","lineNumber":51,"sourceCode":"        f'{error_prefix} There should be at least 2 inputs to join.')\n\n\ndef _validate_type(type, pcolls):\n  error_prefix = f'Invalid value \"{type}\" for \"type\".'\n  if not isinstance(type, dict) and not isinstance(type, str):\n    raise ValueError(f'{error_prefix} It must be a dict or a str.')\n  if isinstance(type, dict):\n    error = ValueError(\n        f'{error_prefix} When specifying a dict for type, '\n        f'it must follow this format: '\n        f'{{\"outer\": [list of inputs to outer join]}}. '\n        f'Example: {{\"outer\": [\"input1\", \"input2\"]}}')\n    if (len(type) != 1 or next(iter(type)) != 'outer' or\n        not isinstance(type['outer'], list)):\n      raise error\n    for input in type['outer']:\n      if input not in list(pcolls.keys()):\n        raise ValueError(\n            f'{error_prefix} An invalid input \"{input}\" was specified.')\n  if isinstance(type, str) and type not in ('inner', 'outer', 'left', 'right'):\n    raise ValueError(\n        f'{error_prefix} When specifying the value for type as a str, '\n        f'it must be one of the following: \"inner\", \"outer\", \"left\", \"right\"')\n\n\ndef _validate_equalities(equalities, pcolls):\n  error_prefix = f'Invalid value \"{equalities}\" for \"equalities\".'\n\n  valid_cols = {\n      name: set(\n          dict(fields).keys() if fields and all(\n              isinstance(field, tuple) for field in fields) else fields)\n      for (name, pcoll) in pcolls.items()\n      for fields in [getattr(pcoll.element_type, '_fields', [])]\n  }\n","sourceCodeStart":33,"sourceCodeEnd":69,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/python/apache_beam/yaml/yaml_join.py#L33-L69","documentation":"Thrown by _validate_type when 'type' is a dict but malformed: it must contain exactly one key 'outer' mapping to a list, e.g. {\"outer\": [\"input1\", \"input2\"]}. Any other key, more than one key, or a non-list 'outer' value triggers this.","triggerScenarios":"type: {outer: input1} (outer not a list); type: {left: [...]} (wrong key); type: {outer: [...], inner: [...]} (multiple keys).","commonSituations":"Authors familiar with pandas merge semantics guessing at the format; writing outer joins for more than one subset of inputs; YAML indentation mistakes nesting the list wrong.","solutions":["Use exactly {\"outer\": [\"input1\", ...]} with 'outer' as the sole key mapping to a list of input tags.","For non-outer joins use the plain string form instead of a dict.","Verify with the example in the error message."],"exampleFix":"// before\ntype: {outer: input1}\n// after\ntype: {outer: [input1, input2]}","handlingStrategy":"validation","validationCode":"if isinstance(t, dict) and (list(t) != ['outer'] or not isinstance(t.get('outer'), list)):\n    raise ValueError('dict type must be exactly {\"outer\": [input tags]}')","typeGuard":"def is_valid_outer_type_dict(t):\n    return isinstance(t, dict) and list(t) == ['outer'] and isinstance(t['outer'], list)","tryCatchPattern":null,"preventionTips":["Copy the documented example {\"outer\": [\"input1\", \"input2\"]} verbatim","Check YAML nesting: outer's value must be a list","Only one key ('outer') is allowed in the dict form"],"tags":["apache-beam","yaml","join","validation"],"backgroundTag":"invalid-argument-format","analyzedSha":"12126d8942aaf848030c478b4c6a28c6af861c66","analyzedAt":"2026-09-13T01:50:10.254Z","contentChangedAt":"2026-09-13T01:50:10.254Z","schemaVersion":2},"datasetVersion":"2026-09-20T03:17:13.778Z"}