{"record":{"id":"317a753a060fdd5b","repo":"apache/beam","slug":"only-avro-and-json-are-supported-as-intermediate-formats-for","errorCode":null,"errorMessage":"Only AVRO and JSON are supported as intermediate formats for BigQuery WriteRecordsToFile, got: {}.","messagePattern":"Only AVRO and JSON are supported as intermediate formats for BigQuery WriteRecordsToFile, got: (.+?)\\.","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"sdks/python/apache_beam/io/gcp/bigquery_file_loads.py","lineNumber":186,"sourceCode":"      if not fs.FileSystems.exists(directory):\n        raise\n\n  file_name = str(uuid.uuid4())\n  file_path = fs.FileSystems.join(file_prefix, destination, file_name)\n\n  if file_format == bigquery_tools.FileFormat.AVRO:\n    if callable(schema):\n      schema = schema(destination, *schema_side_inputs)\n    elif isinstance(schema, vp.ValueProvider):\n      schema = schema.get()\n\n    writer = bigquery_tools.AvroRowWriter(\n        fs.FileSystems.create(file_path, \"application/avro\"), schema)\n  elif file_format == bigquery_tools.FileFormat.JSON:\n    writer = bigquery_tools.JsonRowWriter(\n        fs.FileSystems.create(file_path, \"application/text\"))\n  else:\n    raise ValueError((\n        'Only AVRO and JSON are supported as intermediate formats for '\n        'BigQuery WriteRecordsToFile, got: {}.').format(file_format))\n\n  return file_path, writer\n\n\ndef _bq_uuid(seed=None):\n  if not seed:\n    return str(uuid.uuid4()).replace(\"-\", \"\")\n  else:\n    return str(hashlib.md5(seed.encode('utf8')).hexdigest())\n\n\nclass _ShardDestinations(beam.DoFn):\n  \"\"\"Adds a shard number to the key of the KV element.\n\n  Experimental; no backwards compatibility guarantees.\"\"\"\n  DEFAULT_SHARDING_FACTOR = 10","sourceCodeStart":168,"sourceCodeEnd":204,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/python/apache_beam/io/gcp/bigquery_file_loads.py#L168-L204","documentation":"BigQuery batch loads write intermediate row files in either AVRO or JSON format (bigquery_tools.FileFormat). _make_new_file_writer only handles these two formats; any other file_format value reaches the else branch and raises this ValueError.","triggerScenarios":"Constructing WriteToBigQuery / BigQueryBatchFileLoads with temp_file_format set to something other than bigquery_tools.FileFormat.AVRO or FileFormat.JSON.","commonSituations":"Passing a raw string like 'csv' or 'parquet' as temp_file_format, or a typo'd custom enum value, when trying to change the staging file format.","solutions":["Use temp_file_format=apache_beam.io.gcp.bigquery_tools.FileFormat.AVRO or FileFormat.JSON.","Omit temp_file_format entirely to use the JSON default.","Remove any custom string value like 'csv'/'parquet' — those formats are not supported."],"exampleFix":"// before\nbeam.io.WriteToBigQuery(table, temp_file_format='parquet')\n// after\nfrom apache_beam.io.gcp.bigquery_tools import FileFormat\nbeam.io.WriteToBigQuery(table, temp_file_format=FileFormat.AVRO)","handlingStrategy":"type-guard","validationCode":"from apache_beam.io.gcp.bigquery_tools import FileFormat\nassert temp_file_format in (FileFormat.AVRO, FileFormat.JSON, None)","typeGuard":"def is_valid_intermediate_format(fmt) -> bool:\n    from apache_beam.io.gcp.bigquery_tools import FileFormat\n    return fmt in (FileFormat.AVRO, FileFormat.JSON)","tryCatchPattern":null,"preventionTips":["Only use FileFormat enum members, never raw strings","Omit temp_file_format to accept the default","Check the FileFormat enum for supported values before upgrading Beam"],"tags":["bigquery","enum","beam","unsupported-format"],"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-20T03:17:13.778Z"}