{"record":{"id":"8e78213f36374fc5","repo":"apache/beam","slug":"unknown-format-format","errorCode":null,"errorMessage":"Unknown format: {format}","messagePattern":"Unknown format: (.+?)","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"sdks/python/apache_beam/yaml/yaml_io.py","lineNumber":272,"sourceCode":"        schema_pb2.Schema(fields=[schemas.schema_field('payload', str)]),\n        lambda payload: beam.Row(payload=payload.decode('utf-8')))\n  elif format == 'JSON':\n    _validate_schema()\n    beam_schema = json_utils.json_schema_to_beam_schema(schema)\n    return beam_schema, json_utils.json_parser(beam_schema, schema)\n  elif format == 'AVRO':\n    _validate_schema()\n    beam_schema = avroio.avro_schema_to_beam_schema(schema)\n    covert_to_row = avroio.avro_dict_to_beam_row(schema, beam_schema)\n    return (\n        beam_schema, lambda record: covert_to_row(\n            fastavro.schemaless_reader(io.BytesIO(record), schema)))\n  elif format == 'PROTO':\n    _validate_schema()\n    beam_schema = json_utils.json_schema_to_beam_schema(schema)\n    return beam_schema, RowCoder(beam_schema).decode\n  else:\n    raise ValueError(f'Unknown format: {format}')\n\n\ndef _create_formatter(\n    format, schema: Any,\n    beam_schema: schema_pb2.Schema) -> Callable[[beam.Row], bytes]:\n\n  if format.islower():\n    format = format.upper()\n\n  if format == 'RAW':\n    if schema:\n      raise ValueError('RAW format does not take a schema')\n    field_names = [field.name for field in beam_schema.fields]\n    if len(field_names) != 1:\n      raise ValueError(f'Expecting exactly one field, found {field_names}')\n\n    def convert_to_bytes(row):\n      output = getattr(row, field_names[0])","sourceCodeStart":254,"sourceCodeEnd":290,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/python/apache_beam/yaml/yaml_io.py#L254-L290","documentation":"_create_parser supports a fixed set of Pub/Sub read formats: RAW, STRING, JSON, AVRO, and PROTO (the parser's format is normalized with .upper()). If the requested format matches none of these branches, it raises ValueError('Unknown format: {format}').","triggerScenarios":"Calling read_from_pubsub with format set to anything outside RAW/STRING/JSON/AVRO/PROTO — e.g. 'CSV', 'PARQUET', 'utf-8', or lowercase variants are fine (uppercased) but unsupported names are not.","commonSituations":"Assuming all file formats are valid Pub/Sub formats; typos like 'AVRO ' with trailing space or 'jsn'; copying write-side formats (e.g. BYTES) to the read side.","solutions":["Use one of the supported formats: RAW, STRING, JSON, AVRO, PROTO (case-insensitive).","Fix typos/whitespace in the format value in the YAML config.","For unsupported encodings, read RAW and decode/parse with a custom Map transform."],"exampleFix":"// before\n- type: ReadFromPubSub\n  format: CSV\n// after\n- type: ReadFromPubSub\n  format: RAW\n# then parse CSV with a Map transform","handlingStrategy":"validation","validationCode":"SUPPORTED = {'RAW', 'STRING', 'JSON', 'AVRO', 'PROTO'}\nif fmt.upper() not in SUPPORTED:\n    raise ValueError(f\"Unknown format: {fmt}; use one of {sorted(SUPPORTED)}\")","typeGuard":null,"tryCatchPattern":"try:\n    read_from_pubsub(format=fmt)\nexcept ValueError as e:\n    if str(e).startswith('Unknown format'):\n        fmt = 'JSON'","preventionTips":["Check the supported Pub/Sub format list before configuring (RAW/STRING/JSON/AVRO/PROTO).","Normalize and strip whitespace on format values in config tooling.","Add enum validation to YAML schema tooling (e.g. jsonschema enum)."],"tags":["python","apache-beam","yaml","pubsub","invalid-enum"],"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"}