{"record":{"id":"35d2c28ca3da618c","repo":"apache/beam","slug":"invalid-schema-update-option-s-expecting-s","errorCode":null,"errorMessage":"Invalid schema update option %s. Expecting %s","messagePattern":"Invalid schema update option (.+?)\\. Expecting (.+?)","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"sdks/python/apache_beam/io/gcp/bigquery.py","lineNumber":634,"sourceCode":"\n  ALLOW_FIELD_ADDITION = 'ALLOW_FIELD_ADDITION'\n  ALLOW_FIELD_RELAXATION = 'ALLOW_FIELD_RELAXATION'\n\n  @staticmethod\n  def validate(options):\n    if options is None:\n      return None\n    if not isinstance(options, list):\n      raise ValueError(\n          'schema_update_options must be a list. Received %s.' %\n          type(options).__name__)\n    values = tuple(option.value for option in BigQuerySchemaUpdateOption)\n    validated_options = []\n    for option in options:\n      try:\n        validated_options.append(BigQuerySchemaUpdateOption(option).value)\n      except ValueError:\n        raise ValueError(\n            'Invalid schema update option %s. Expecting %s' %\n            (option, values)) from None\n    return validated_options\n\n\nclass BigQueryQueryPriority(object):\n  \"\"\"Class holding standard strings used for query priority.\"\"\"\n\n  INTERACTIVE = 'INTERACTIVE'\n  BATCH = 'BATCH'\n\n\n# -----------------------------------------------------------------------------\n# BigQuerySource, BigQuerySink.\n\n\n@deprecated(since='2.25.0', current=\"ReadFromBigQuery\")\ndef BigQuerySource(","sourceCodeStart":616,"sourceCodeEnd":652,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/python/apache_beam/io/gcp/bigquery.py#L616-L652","documentation":"Each entry in schema_update_options must be a valid BigQuerySchemaUpdateOption (ALLOW_FIELD_ADDITION or ALLOW_FIELD_RELAXATION); an unrecognized option string raises ValueError listing the valid values.","triggerScenarios":"Passing an option with wrong spelling/case such as 'ALLOW_FIELD_ADDITIONS' or 'FIELD_RELAXATION' inside the schema_update_options list.","commonSituations":"Typos, outdated option names from older Beam versions, or options invented to match other BigQuery client libraries.","solutions":["Use BigQuerySchemaUpdateOption.ALLOW_FIELD_ADDITION or ALLOW_FIELD_RELAXATION values exactly","Fix spelling/casing of the option string","Pre-validate with BigQuerySchemaUpdateOption.validate(options) before constructing the sink"],"exampleFix":"// before\nWriteToBigQuery(..., schema_update_options=['ALLOW_FIELD_ADDITIONS'])\n// after\nWriteToBigQuery(..., schema_update_options=['ALLOW_FIELD_ADDITION'])","handlingStrategy":"validation","validationCode":"from apache_beam.io.gcp.bigquery import BigQuerySchemaUpdateOption\nvalid = {o.value for o in BigQuerySchemaUpdateOption}\nassert all(o in valid for o in (schema_update_options or [])), f'options must be in {valid}'","typeGuard":"def is_valid_schema_update_option(o):\n    try:\n        BigQuerySchemaUpdateOption(o)\n        return True\n    except ValueError:\n        return False","tryCatchPattern":"try:\n    BigQuerySchemaUpdateOption.validate(options)\nexcept ValueError as e:\n    if 'Invalid schema update option' in str(e):\n        options = [o for o in options if is_valid_schema_update_option(o)]\n    else:\n        raise","preventionTips":["Reference BigQuerySchemaUpdateOption.ALLOW_FIELD_ADDITION/ALLOW_FIELD_RELAXATION instead of literals","Only ALLOW_FIELD_ADDITION and ALLOW_FIELD_RELAXATION exist — check spelling","Validate options at config load time"],"tags":["python","apache-beam","bigquery","enum","validation"],"backgroundTag":"invalid-enum-value","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"}