{"record":{"id":"9579a8cdc119ed02","repo":"apache/beam","slug":"invalid-column-v-in-fields-column-name-must-be-a-str","errorCode":null,"errorMessage":"Invalid column \"{v}\" in \"fields\". Column name must be a str.","messagePattern":"Invalid column \"(.+?)\" in \"fields\"\\. Column name must be a str\\.","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"sdks/python/apache_beam/yaml/yaml_join.py","lineNumber":135,"sourceCode":"    if input not in tables:\n      raise ValueError(f'An invalid input \"{input}\" was specified in \"fields\".')\n    if isinstance(cols, list):\n      for col in cols:\n        if not isinstance(col, str):\n          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:","sourceCodeStart":117,"sourceCodeEnd":153,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/python/apache_beam/yaml/yaml_join.py#L117-L153","documentation":"Type guard inside _parse_fields for YAML Join: a column name listed under an input in 'fields' is not a string (e.g. a number or null parsed from the YAML), but SQL column references must be string identifiers.","triggerScenarios":"fields: {left: {id: 42}} or a value that YAML parsed as an int/bool/float instead of a string column name.","commonSituations":"Unquoted numeric or boolean-looking column names in YAML; pasting expressions instead of plain column names into the source-column position.","solutions":["Quote the source column name so it stays a string, e.g. {x: \"42\"}.","Verify the value points at an actual string column in that input.","Compute/derive non-string values upstream in a separate transform before joining."],"exampleFix":"// before\nfields:\n  left: {id: 42}\n// after\nfields:\n  left: {id: \"42\"}","handlingStrategy":"type-guard","validationCode":"def check_dict_values(fields):\n    for alias, cols in fields.items():\n        if isinstance(cols, dict):\n            assert all(isinstance(v, str) for v in cols.values()), f'non-str source column for {alias}'","typeGuard":"def dict_values_all_str(d):\n    return isinstance(d, dict) and all(isinstance(v, str) for v in d.values())","tryCatchPattern":"try:\n    result = SqlJoinTransform(config)\nexcept ValueError as e:\n    if 'Column name must be a str' in str(e):\n        raise ConfigError('source column values in fields dicts must be strings') from e\n    raise","preventionTips":["Quote YAML values that could parse as int/float/bool","Verify with yaml.safe_load that source column values are str","Only use plain column names as dict values, not expressions"],"tags":["apache-beam","yaml","type-error","fields"],"backgroundTag":"type-mismatch","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"}