{"record":{"id":"ca15c37b30275485","repo":"apache/beam","slug":"unsupported-field-type-type","errorCode":null,"errorMessage":"Unsupported field type: {type}","messagePattern":"Unsupported field type: (.+?)","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"sdks/java/core/src/main/java/org/apache/beam/sdk/util/RowJson.java","lineNumber":617,"sourceCode":"            gen.writeFieldName(entry.getKey().toString());\n            writeValue(gen, type.getMapValueType(), entry.getValue());\n          }\n          gen.writeEndObject();\n          break;\n        case LOGICAL_TYPE:\n          String identifier = type.getLogicalType().getIdentifier();\n          if (SqlTypes.DATE.getIdentifier().equals(identifier)) {\n            gen.writeString(((LocalDate) value).toString()); // ISO 8601 format\n          } else if (SqlTypes.TIME.getIdentifier().equals(identifier)) {\n            gen.writeString(((LocalTime) value).toString()); // ISO 8601 format\n          } else if (SqlTypes.DATETIME.getIdentifier().equals(identifier)) {\n            gen.writeString(((LocalDateTime) value).toString()); // ISO 8601 format\n          } else {\n            writeValue(gen, type.getLogicalType().getBaseType(), value);\n          }\n          break;\n        default:\n          throw new IllegalArgumentException(\"Unsupported field type: \" + type);\n      }\n    }\n  }\n\n  /** Gets thrown when Row parsing or serialization fails for any reason. */\n  public static class UnsupportedRowJsonException extends RuntimeException {\n\n    UnsupportedRowJsonException(String message, Throwable reason) {\n      super(message, reason);\n    }\n\n    UnsupportedRowJsonException(String message) {\n      super(message);\n    }\n  }\n}\n","sourceCodeStart":599,"sourceCodeEnd":634,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/java/core/src/main/java/org/apache/beam/sdk/util/RowJson.java#L599-L634","documentation":"RowJson's serializer (RowJsonCreator's generator) writes Row fields by schema type and handles only a fixed set of types in its switch. Encountering an unsupported Schema.Type in writeValue throws IllegalArgumentException 'Unsupported field type'.","triggerScenarios":"Serializing a Row (RowJsonUtils.rowToJson or objectMapper.writeValueAsString on a Row) whose schema contains a field type not covered by the writer's switch (e.g. certain logical or nested types it does not handle directly).","commonSituations":"Rows built with logical types or newer Beam types not yet supported by the JSON writer; schema evolution introduced an exotic type; custom logical types.","solutions":["Check the switch in RowJson.RowWriter.writeValue and only serialize supported types","Convert unsupported fields to supported types (e.g. logical type to its base type or String) before serialization","Register/handle the logical type explicitly, or flatten the schema","Catch IllegalArgumentException around rowToJson to handle offending rows"],"exampleFix":"// before: field of unsupported logical type serialized directly\nrowToJson(mapper, rowWithCustomLogicalType);\n// after: convert to base type/string first\nRow fixed = rowFrom(ROW_SCHEMA).withFieldValue(\"ts\", ts.toString()).build();\nrowToJson(mapper, fixed);","handlingStrategy":"try-catch","validationCode":"boolean allSupported = row.getSchema().getFields().stream()\n    .allMatch(f -> SUPPORTED_WRITER_TYPES.contains(f.getType().getTypeName()));\nif (!allSupported) { /* convert or skip row */ }","typeGuard":null,"tryCatchPattern":"try { String s = RowJsonUtils.rowToJson(mapper, row); } catch (IllegalArgumentException e) { /* row contains unsupported field type */ }","preventionTips":["Check the writeValue switch for supported Schema.Types before serializing","Convert custom/logical types to base types or strings","Add serialization smoke tests for evolving schemas"],"tags":["beam","json","serialization","unsupported-type"],"backgroundTag":"unsupported-operation","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"}