{"record":{"id":"e814849ed65a7dd0","repo":"apache/beam","slug":"unrecognized-type-info-type-info-r-json-utils","errorCode":null,"errorMessage":"Unrecognized type_info: {type_info!r}","messagePattern":"Unrecognized type_info: (.+?)","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"sdks/python/apache_beam/yaml/json_utils.py","lineNumber":222,"sourceCode":"        for field in beam_type.row_type.schema.fields\n    }\n\n    def convert_row(value):\n      kwargs = {}\n      for name, convert in converters.items():\n        if name in value:\n          kwargs[name] = convert(value[name])\n        elif field_nullable_status[name]:\n          kwargs[name] = convert(None)\n        else:\n          raise KeyError(f\"Missing required field: {name}\")\n      return beam.Row(**kwargs)\n\n    return convert_row\n  elif type_info == \"logical_type\":\n    return lambda value: value\n  else:\n    raise ValueError(f\"Unrecognized type_info: {type_info!r}\")\n\n\ndef json_parser(\n    beam_schema: schema_pb2.Schema,\n    json_schema: Optional[dict[str,\n                               Any]] = None) -> Callable[[bytes], beam.Row]:\n  \"\"\"Returns a callable converting Json strings to Beam rows of the given type.\n\n  The input to the returned callable is expected to conform to the Json schema\n  corresponding to this Beam type.\n  \"\"\"\n  if json_schema is None:\n    validate_fn = None\n  else:\n    cls = jsonschema.validators.validator_for(json_schema)\n    cls.check_schema(json_schema)\n    validate_fn = _PicklableFromConstructor(\n        lambda: jsonschema.validators.validator_for(json_schema)","sourceCodeStart":204,"sourceCodeEnd":240,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/python/apache_beam/yaml/json_utils.py#L204-L240","documentation":"json_to_row dispatches on the Beam FieldType's type_info discriminator; if it encounters a type_info string it does not handle (e.g. logical variants or newer proto types beyond row/array/iterable/map/logical), it raises ValueError with the unrecognized discriminator. This indicates the schema contains a type the JSON converter cannot translate.","triggerScenarios":"A Beam schema containing a FieldType whose WhichOneof('type_info') is not one of the handled branches (atomic_type, array_type, iterable_type, map_type, row_type, logical_type) being processed by json_to_row or json_parser.","commonSituations":"Schemas with enum or newer proto types in a JSON-consuming yaml pipeline; Beam version drift introducing new type kinds before json_utils.py was extended.","solutions":["Simplify the schema to JSON-representable types (atomic, array, map, row, logical)","Extend json_to_row with a branch for the missing type_info","Check the Beam version for known gaps and upgrade to a release that supports the type"],"exampleFix":"# before\nschema: \"enum<VALID,INVALID> status\"\n# after\nschema: \"string status\"","handlingStrategy":"validation","validationCode":"HANDLED = {'atomic_type','array_type','iterable_type','map_type','row_type','logical_type'}\ndef assert_json_convertible(beam_schema):\n    bad = [f.name for f in beam_schema.fields if f.type.WhichOneof('type_info') not in HANDLED]\n    if bad:\n        raise ValueError(f'Fields not JSON-convertible: {bad}')","typeGuard":"def is_json_convertible(beam_type) -> bool:\n    return beam_type.WhichOneof('type_info') in {'atomic_type','array_type','iterable_type','map_type','row_type','logical_type'}","tryCatchPattern":"try:\n    row = json_parser(beam_schema)(raw)\nexcept ValueError as e:\n    raise ValueError(f'Schema contains types unsupported by the JSON converter: {e}') from e","preventionTips":["Restrict JSON-path schemas to atomic/array/map/row/logical types","Replace enum/proto-only types with strings in JSON-facing schemas","Verify schema types whenever upgrading apache-beam"],"tags":["python","apache-beam","json","schema","type-system"],"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"}