{"record":{"id":"0fa86638745da1d4","repo":"apache/beam","slug":"failed-to-print-type-columnmetadataproto-gettype-tostring","errorCode":null,"errorMessage":"Failed to print type: {columnMetadataProto.getType().toString()}","messagePattern":"Failed to print type: (.+?)","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"sdks/java/io/google-cloud-platform/src/main/java/org/apache/beam/sdk/io/gcp/spanner/changestreams/mapper/ChangeStreamRecordMapper.java","lineNumber":361,"sourceCode":"        dataChangeRecordProto.getNumberOfRecordsInTransaction(),\n        dataChangeRecordProto.getNumberOfPartitionsInTransaction(),\n        dataChangeRecordProto.getTransactionTag(),\n        dataChangeRecordProto.getIsSystemTransaction(),\n        changeStreamRecordMetadataFrom(partition, commitTimestamp, resultSetMetadata));\n  }\n\n  List<ColumnType> parseProtoColumnMetadata(\n      List<com.google.spanner.v1.ChangeStreamRecord.DataChangeRecord.ColumnMetadata>\n          columnMetadataProtos) {\n    List<ColumnType> columnTypes = new ArrayList<>();\n    for (com.google.spanner.v1.ChangeStreamRecord.DataChangeRecord.ColumnMetadata\n        columnMetadataProto : columnMetadataProtos) {\n      // TypeCode class takes json format argument in its constructor, e.g. `{\\\"code\\\":\\\"INT64\\\"}`.\n      String typeCodeJson;\n      try {\n        typeCodeJson = this.printer.print(columnMetadataProto.getType());\n      } catch (InvalidProtocolBufferException exc) {\n        throw new IllegalArgumentException(\n            \"Failed to print type: \" + columnMetadataProto.getType().toString());\n      }\n      ColumnType columnType =\n          new ColumnType(\n              columnMetadataProto.getName(),\n              new TypeCode(typeCodeJson),\n              columnMetadataProto.getIsPrimaryKey(),\n              columnMetadataProto.getOrdinalPosition());\n      columnTypes.add(columnType);\n    }\n    return columnTypes;\n  }\n\n  String convertModValueProtosToJson(\n      List<com.google.spanner.v1.ChangeStreamRecord.DataChangeRecord.ModValue> modValueProtos,\n      List<com.google.spanner.v1.ChangeStreamRecord.DataChangeRecord.ColumnMetadata>\n          columnMetadataProtos) {\n    com.google.protobuf.Struct.Builder modStructValueBuilder =","sourceCodeStart":343,"sourceCodeEnd":379,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/java/io/google-cloud-platform/src/main/java/org/apache/beam/sdk/io/gcp/spanner/changestreams/mapper/ChangeStreamRecordMapper.java#L343-L379","documentation":"In parseProtoColumnMetadata, the connector prints the column's Type proto to its JSON form (e.g. {\"code\":\"INT64\"}) using a JsonFormat printer to feed the TypeCode class. If the Type proto is invalid/unprintable (InvalidProtocolBufferException), it throws IllegalArgumentException with the proto's toString.","triggerScenarios":"A DataChangeRecord's column metadata contains a Type proto that the JsonFormat printer rejects — malformed any-value payloads, unexpected proto fields from a newer Spanner format, or corrupted metadata bytes.","commonSituations":"Connector/protos version mismatch where the printer's type registry lacks the embedded Type message; corrupted change stream metadata rows; PG-dialect type definitions the older proto can't render.","solutions":["Upgrade the Beam Spanner connector and its google.spanner.v1 protos so JsonFormat can print all Type variants.","Log/print columnMetadataProto.getType() to identify the malformed field and check the originating change stream record.","Re-read the partition or reset from an earlier timestamp if the metadata record is corrupt.","Confirm the column's type is a standard Spanner type supported by the change stream mapper."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"try { printer.print(columnMetadataProto.getType()); } catch (InvalidProtocolBufferException e) { /* flag record before mapping */ }","typeGuard":null,"tryCatchPattern":"try { typeCodeJson = printer.print(columnMetadataProto.getType()); } catch (InvalidProtocolBufferException e) {\n  log.error(\"Unprintable column type: {}\", columnMetadataProto.getType(), e);\n}","preventionTips":["Keep google.spanner.v1 protos and the Beam connector at compatible versions.","Validate column types in change stream records are standard Spanner TypeCodes.","Re-read corrupt partitions rather than retrying the same record indefinitely."],"tags":["spanner","protobuf","json","java"],"backgroundTag":"json-marshal-failed","analyzedSha":"12126d8942aaf848030c478b4c6a28c6af861c66","analyzedAt":"2026-09-13T01:50:10.254Z","contentChangedAt":"2026-09-13T01:50:10.254Z","schemaVersion":2},"datasetVersion":"2026-09-14T21:17:11.552Z"}