{"record":{"id":"4e076732d3ae585c","repo":"apache/beam","slug":"s-can-be-set-with-either-schema-update-options-or-additional","errorCode":null,"errorMessage":"%s can be set with either schema_update_options or additional_bq_parameters, but not both.","messagePattern":"(.+?) can be set with either schema_update_options or additional_bq_parameters, but not both\\.","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"sdks/python/apache_beam/io/gcp/bigquery.py","lineNumber":495,"sourceCode":"of retries.\n\"\"\"\nMAX_INSERT_RETRIES = 10000\n\"\"\"\nThe maximum byte size for a BigQuery legacy streaming insert payload.\n\nNote: The actual limit is 10MB, but we set it to 9MB to make room for request\noverhead: https://cloud.google.com/bigquery/quotas#streaming_inserts\n\"\"\"\nMAX_INSERT_PAYLOAD_SIZE = 9 << 20\n\n_SCHEMA_UPDATE_OPTIONS = 'schemaUpdateOptions'\n\n\ndef _merge_schema_update_options(\n    additional_bq_parameters, schema_update_options):\n  additional_bq_parameters = dict(additional_bq_parameters or {})\n  if _SCHEMA_UPDATE_OPTIONS in additional_bq_parameters:\n    raise ValueError(\n        '%s can be set with either schema_update_options or '\n        'additional_bq_parameters, but not both.' % _SCHEMA_UPDATE_OPTIONS)\n  additional_bq_parameters[_SCHEMA_UPDATE_OPTIONS] = schema_update_options\n  return additional_bq_parameters\n\n\nclass _AdditionalBQParametersWithSchemaUpdateOptions(object):\n  def __init__(self, additional_bq_parameters, schema_update_options):\n    self.additional_bq_parameters = additional_bq_parameters\n    self.schema_update_options = schema_update_options\n\n  def __call__(self, destination):\n    if callable(self.additional_bq_parameters):\n      additional_bq_parameters = self.additional_bq_parameters(destination)\n    elif isinstance(self.additional_bq_parameters, vp.ValueProvider):\n      additional_bq_parameters = self.additional_bq_parameters.get()\n    else:\n      additional_bq_parameters = self.additional_bq_parameters","sourceCodeStart":477,"sourceCodeEnd":513,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/python/apache_beam/io/gcp/bigquery.py#L477-L513","documentation":"BigQuery sink configuration forbids setting the _SCHEMA_UPDATE_OPTIONS key inside additional_bq_parameters when schema_update_options is also provided, since the same option would be specified twice with possibly conflicting values.","triggerScenarios":"Calling BigQueryWriteResults/WriteToBigQuery transform path where additional_bq_parameters dict already contains SCHEMA_UPDATE_OPTIONS key and schema_update_options is also passed (via __call__ or _additional_bq_parameters_for_file_loads).","commonSituations":"Users migrating code that set schema update options through raw additional_bq_parameters (job config) and then also added the newer schema_update_options parameter.","solutions":["Remove the SCHEMA_UPDATE_OPTIONS key from additional_bq_parameters and pass those options via schema_update_options instead","Or remove the schema_update_options argument and keep options only in additional_bq_parameters"],"exampleFix":"// before\nWriteToBigQuery(table=t, additional_bq_parameters={'schemaUpdateOptions': ['ALLOW_FIELD_ADDITION']}, schema_update_options=['ALLOW_FIELD_ADDITION'])\n// after\nWriteToBigQuery(table=t, schema_update_options=['ALLOW_FIELD_ADDITION'])","handlingStrategy":"validation","validationCode":"if additional_bq_parameters and 'schemaUpdateOptions' in additional_bq_parameters and schema_update_options:\n    raise ValueError('Set schema update options via schema_update_options only')","typeGuard":null,"tryCatchPattern":"try:\n    result = transform(args)\nexcept ValueError as e:\n    if 'but not both' in str(e):\n        additional_bq_parameters.pop('schemaUpdateOptions', None)\n        result = transform(args)\n    else:\n        raise","preventionTips":["Keep schema update options only in schema_update_options","Never hand-populate SCHEMA_UPDATE_OPTIONS in additional_bq_parameters","Review transform kwargs when migrating between Beam versions"],"tags":["python","apache-beam","bigquery","configuration"],"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-14T16:17:12.679Z"}