{"record":{"id":"7a87cd4a8c50b692","repo":"apache/beam","slug":"the-field-name-k-was-specified-more-than-once","errorCode":null,"errorMessage":"The field name \"{k}\" was specified more than once.","messagePattern":"The field name \"(.+?)\" was specified more than once\\.","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"sdks/python/apache_beam/yaml/yaml_join.py","lineNumber":132,"sourceCode":"  output_fields = []\n  named_columns = set()\n  for input, cols in fields.items():\n    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):","sourceCodeStart":114,"sourceCodeEnd":150,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/python/apache_beam/yaml/yaml_join.py#L114-L150","documentation":"Same uniqueness rule as the list form: when 'fields' values are dicts mapping outputName -> sourceColumn, each output name (the dict key k) must be unique across all inputs. A repeated output name raises this ValueError.","triggerScenarios":"fields: {left: {id: id}, right: {id: user_id}} — both outputs named 'id'; mixing list and dict forms where list form already emitted the same name.","commonSituations":"Renaming the source column but not the output name, leaving a collision with another table's column; incremental edits adding a key that duplicates an existing output.","solutions":["Choose a distinct output name for one of the conflicting keys.","Rename the other input's output so names do not collide.","Track which output names already exist across all fields entries before adding new ones."],"exampleFix":"// before\nfields:\n  left: {id: id}\n  right: {id: user_id}\n// after\nfields:\n  left: {id: id}\n  right: {right_id: user_id}","handlingStrategy":"validation","validationCode":"def check_dict_keys_unique(fields):\n    seen = set()\n    for alias, cols in fields.items():\n        if isinstance(cols, dict):\n            for k in cols:\n                if k in seen:\n                    raise ValueError(f'duplicate output name: {k}')\n                seen.add(k)","typeGuard":null,"tryCatchPattern":"try:\n    result = SqlJoinTransform(config)\nexcept ValueError as e:\n    if 'specified more than once' in str(e):\n        raise ConfigError('output names in fields dicts must be globally unique') from e\n    raise","preventionTips":["Namespace output names per table, e.g. left_id, right_id","Search the spec for each output key before adding a new one","Adopt a naming convention for renamed columns"],"tags":["apache-beam","yaml","validation","duplicate"],"backgroundTag":"conflicting-config-options","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"}