{"record":{"id":"d2424b017ae3408e","repo":"apache/beam","slug":"invalid-value-fields-for-fields-for-every-input-key-in","errorCode":null,"errorMessage":"Invalid value \"{fields}\" for \"fields\". For every input key in fields, the value must either be a list or dict.","messagePattern":"Invalid value \"(.+?)\" for \"fields\"\\. For every input key in fields, the value must either be a list or dict\\.","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"sdks/python/apache_beam/yaml/yaml_join.py","lineNumber":140,"sourceCode":"          raise ValueError(\n              f'Invalid column \"{col}\" in \"fields\". Column name must be a str.')\n        if col in named_columns:\n          raise ValueError(\n              f'The field name \"{col}\" was specified more than once.')\n        output_fields.append(f'{input}.{col} AS {col}')\n        named_columns.add(col)\n    elif isinstance(cols, dict):\n      for k, v in cols.items():\n        if k in named_columns:\n          raise ValueError(\n              f'The field name \"{k}\" was specified more than once.')\n        if not isinstance(v, str):\n          raise ValueError(\n              f'Invalid column \"{v}\" in \"fields\". Column name must be a str.')\n        output_fields.append(f'{input}.{v} AS {k}')\n        named_columns.add(k)\n    else:\n      raise ValueError(\n          f'{error_prefix} '\n          f'For every input key in fields, '\n          f'the value must either be a list or dict.')\n  for table in tables:\n    if table not in fields.keys():\n      output_fields.append(f'{table}.*')\n  return output_fields\n\n\ndef _is_connected(edge_list, expected_node_count):\n  graph = {}\n  for edge_set in edge_list:\n    for u in edge_set:\n      if u not in graph:\n        graph[u] = set()\n      for v in edge_set:\n        if u != v:\n          graph[u].add(v)","sourceCodeStart":122,"sourceCodeEnd":158,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/python/apache_beam/yaml/yaml_join.py#L122-L158","documentation":"Each value in the 'fields' mapping must be either a list of column names or a dict of {outputName: sourceColumn}. Any other value type (string, number, etc.) for an input key falls through both branches and raises this ValueError.","triggerScenarios":"fields: {left: id} (a bare string), {left: 3}, or a value that YAML parsed as a scalar instead of a list/dict.","commonSituations":"Users expecting a single string to mean 'just this one column'; YAML indentation errors that flatten a list into a scalar; copying config from a transform with a different fields convention.","solutions":["Wrap the column in a list: left: [id].","Use the dict form for renamed columns: left: {id: id}.","Check YAML indentation so the value parses as a list or mapping, not a scalar."],"exampleFix":"// before\nfields:\n  left: id\n// after\nfields:\n  left: [id]","handlingStrategy":"type-guard","validationCode":"def check_fields_value_types(fields):\n    for alias, cols in fields.items():\n        if not isinstance(cols, (list, dict)):\n            raise ValueError(f'fields[{alias!r}] must be a list or dict, got {type(cols).__name__}')","typeGuard":"def is_list_or_dict(v):\n    return isinstance(v, (list, dict))","tryCatchPattern":"try:\n    result = SqlJoinTransform(config)\nexcept ValueError as e:\n    if 'must either be a list or dict' in str(e):\n        raise ConfigError('wrap single columns in a list, e.g. left: [id]') from e\n    raise","preventionTips":["Never assign a bare scalar as a fields value","Validate the parsed spec shape before running the pipeline","Follow the per-input convention: alias -> list of names or dict of renames"],"tags":["apache-beam","yaml","validation","fields"],"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"}