apache/beam · error · ValueError

Unrecognized type_info

Error message

Unrecognized type_info: {type_info!r}

What it means

`_validator` dispatches on the FieldType's `type_info` oneof (atomic_type, array_type, iterable_type, map_type, row_type). If the oneof is unset or set to something else (e.g. an empty/default FieldType or logical_type), the recursion falls through to this ValueError.

Solutions

  1. Check the output_type spec for malformed nested entries (missing element_type for arrays, key/value types for maps).
  2. Restrict output_type declarations to types _validator supports: atomic types, arrays, iterables, maps, and nested rows.
  3. If a logical/null type is needed, extend _validator in yaml_mapping.py to handle that type_info.

Example fix

# before
output_type:
  type: array
# after
output_type:
  type: array
  element_type: string
Defensive patterns

Strategy: validation

Validate before calling

def check_type_spec(spec):
    if isinstance(spec, dict) and 'type' in spec:
        if spec['type'] in ('array', 'iterable'):
            assert 'element_type' in spec or 'items' in spec
        if spec['type'] == 'map':
            assert 'key_type' in spec and 'value_type' in spec

Type guard

def is_complete_type_spec(spec: dict) -> bool:
    if not isinstance(spec, dict) or 'type' not in spec:
        return False
    return spec['type'] not in ('array', 'map') or (
        'element_type' in spec or ('key_type' in spec and 'value_type' in spec))

Try / catch

try:
    run_pipeline(yaml_spec)
except ValueError as e:
    if 'Unrecognized type_info' in str(e):
        raise ConfigError('malformed output_type spec') from e

Prevention

When it happens

Trigger: An output_type or schema-derived Beam type that yields a FieldType with no recognized type_info, e.g. a null_type / logical_type field reached during recursive validation of arrays, maps, or rows, or an empty dict passed as output_type.

Common situations: Declaring nested output_type structures with missing 'element_type'/'value_type' keys, passing an empty output_type dict, or schemas containing logical types that _validator doesn't model.

Understand the failure class

Background: Schema validation failed / invalid input schema: payload rejected because its shape doesn't match the expected schema — this error's family across 28 libraries.

Related errors


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

Appendix: source

Thrown at sdks/python/apache_beam/yaml/yaml_mapping.py:366

    return lambda value: all(element_validator(e) for e in value)
  elif type_info == "iterable_type":
    element_validator = _validator(beam_type.iterable_type.element_type)
    return lambda value: all(element_validator(e) for e in value)
  elif type_info == "map_type":
    key_validator = _validator(beam_type.map_type.key_type)
    value_validator = _validator(beam_type.map_type.value_type)
    return lambda value: all(
        key_validator(k) and value_validator(v) for (k, v) in value.items())
  elif type_info == "row_type":
    validators = {
        field.name: _validator(field.type)
        for field in beam_type.row_type.schema.fields
    }
    return lambda row: all(
        validator(getattr(row, name))
        for (name, validator) in validators.items())
  else:
    raise ValueError(f"Unrecognized type_info: {type_info!r}")


def _as_callable_for_pcoll(
    pcoll,
    fn_spec: Union[str, dict[str, str]],
    msg: str,
    language: Optional[str]):
  if language == 'javascript':
    options.YamlOptions.check_enabled(pcoll.pipeline, 'javascript')

  try:
    input_schema = dict(named_fields_from_element_type(pcoll.element_type))
  except (TypeError, ValueError) as exn:
    if is_expr(fn_spec):
      raise ValueError("Can only use expressions on a schema'd input.") from exn
    input_schema = {}  # unused

  if isinstance(fn_spec, str) and fn_spec in input_schema:

View on GitHub (pinned to 12126d8942)