apache/beam · error · ValueError

Unrecognized type_info: {type_info!r}

Error message

Unrecognized type_info: {type_info!r}

What it means

avroio.avro_value_to_beam_value dispatches on type_info, an internal classification derived from the Beam FieldType (atomic, array, map, row, logical, etc.). If the classification string does not match any handled branch, the function raises ValueError naming the unrecognized type_info, which normally indicates an internal bug or an unsupported/unknown FieldType.

Source

Thrown at sdks/python/apache_beam/io/avroio.py:683

    if beam_type.map_type.key_type.atomic_type != schema_pb2.STRING:
      raise TypeError(
          f'Only strings allowed as map keys when converting from AVRO, '
          f'found {beam_type}')
    value_converter = avro_value_to_beam_value(beam_type.map_type.value_type)
    return lambda value: {k: value_converter(v) for (k, v) in value.items()}
  elif type_info == "row_type":
    converters = {
        field.name: avro_value_to_beam_value(field.type)
        for field in beam_type.row_type.schema.fields
    }
    return lambda value: beam.Row(
        **
        {name: convert(value[name])
         for (name, convert) in converters.items()})
  elif type_info == "logical_type":
    return lambda value: value
  else:
    raise ValueError(f"Unrecognized type_info: {type_info!r}")


def beam_schema_to_avro_schema(
    beam_schema: schema_pb2.Schema) -> _AvroSchemaType:
  return beam_type_to_avro_type(
      schema_pb2.FieldType(row_type=schema_pb2.RowType(schema=beam_schema)))


def unnest_primitive_type(beam_type: schema_pb2.FieldType):
  """unnests beam types that map to avro primitives or unions.
      
      if mapping to a avro primitive or a union, don't nest the field type
      for complex types, like arrays, we need to nest the type.
      Example: { 'type': 'string' } -> 'string'
      { 'type': 'array', 'items': 'string' } 
      -> { 'type': 'array', 'items': 'string' }

      Args:

View on GitHub (pinned to 12126d8942)

Solutions

  1. Inspect the Beam schema's field types and replace unsupported field types with basic ones (atomic, array, map, row)
  2. Upgrade apache-beam — newer releases cover more field types in the converter
  3. Construct your rows with beam.Row / manual Map instead of avro_dict_to_beam_row for exotic types
  4. File a Beam issue with the schema proto if type_info is genuinely unrecognized for a standard type

Example fix

// before
field_type = schema_pb2.FieldType(row_type=schema_pb2.RowType())  # malformed row type
c = avroio.avro_value_to_beam_value(field_type)  # ValueError: Unrecognized type_info
// after
field_type = schema_pb2.FieldType(atomic_type=schema_pb2.STRING)
c = avroio.avro_value_to_beam_value(field_type)
Defensive patterns

Strategy: try-catch

Validate before calling

# preflight: convert a sample row before running the pipeline
sample = next(iter(pcoll))
avroio.avro_dict_to_beam_row(sample, beam_schema)

Try / catch

try:
    row = avroio.avro_dict_to_beam_row(d, beam_schema)
except ValueError as e:
    logging.error('unsupported field type in schema: %s', e)
    row = None  # skip or route to a dead-letter output

Prevention

When it happens

Trigger: Calling avro_value_to_beam_value (via avro_dict_to_beam_row) with a Beam FieldType whose computed type_info is not one of the implemented branches — e.g. unusual field types or a Beam version where classification logic changed.

Common situations: Rare FieldType combinations from programmatic schema construction; schema protos from a newer/older Beam version whose types this avroio converter does not recognize; passing a FieldType that resolves to None/unexpected type_info.

Understand the failure class

Background: Invalid enum value errors: "Unknown type", "Invalid scope", "must be one of" — when a string is not on the library's allowed list — this error's family across 23 libraries.

Related errors


AI-assisted analysis of apache/beam@12126d8942 (2026-09-13). Data as JSON: /api/errors/389bb6ef2b65e059. Report an issue: GitHub.