{"record":{"id":"ec62f316fdce069d","repo":"apache/flink","slug":"unsupported-protobuf-simple-type","errorCode":null,"errorMessage":"Unsupported protobuf simple type: ","messagePattern":"Unsupported protobuf simple type: ","errorType":"exception","errorClass":"PbCodegenException","httpStatus":null,"severity":"error","filePath":"flink-formats/flink-protobuf/src/main/java/org/apache/flink/formats/protobuf/deserialize/PbCodegenSimpleDeserializer.java","lineNumber":81,"sourceCode":"                if (logicalType.getTypeRoot() == LogicalTypeRoot.CHAR\n                        || logicalType.getTypeRoot() == LogicalTypeRoot.VARCHAR) {\n                    appender.appendLine(\n                            resultVar\n                                    + \" = BinaryStringData.fromString(\"\n                                    + pbObjectCode\n                                    + \".toString())\");\n                } else if (logicalType.getTypeRoot() == LogicalTypeRoot.TINYINT\n                        || logicalType.getTypeRoot() == LogicalTypeRoot.SMALLINT\n                        || logicalType.getTypeRoot() == LogicalTypeRoot.INTEGER\n                        || logicalType.getTypeRoot() == LogicalTypeRoot.BIGINT) {\n                    appender.appendLine(resultVar + \" = \" + pbObjectCode + \".getNumber()\");\n                } else {\n                    throw new PbCodegenException(\n                            \"Illegal type for protobuf enum, only char/vachar/int/bigint is supported\");\n                }\n                break;\n            default:\n                throw new PbCodegenException(\n                        \"Unsupported protobuf simple type: \" + fd.getJavaType());\n        }\n        return appender.code();\n    }\n}\n","sourceCodeStart":63,"sourceCodeEnd":87,"githubUrl":"https://github.com/apache/flink/blob/2f3c205e9266cb30240eb7f4fdab15cad629a70f/flink-formats/flink-protobuf/src/main/java/org/apache/flink/formats/protobuf/deserialize/PbCodegenSimpleDeserializer.java#L63-L87","documentation":"PbCodegenSimpleDeserializer switches on the protobuf FieldDescriptor.JavaType; the default branch throws when the java type is not one of the handled simple kinds. Since simple deserializers are only built for non-message, non-repeated fields, hitting this means an unexpected java type (e.g. a MESSAGE or ENUM landing in the wrong branch) — usually a version/bug artifact or an inconsistent type dispatch upstream.","triggerScenarios":"A proto field whose JavaType is MESSAGE reaching the simple deserializer because PbFormatUtils.isSimpleType wrongly classified the Flink type; new protobuf runtime java types not covered by this switch in older flink-protobuf versions.","commonSituations":"Schema drift between the table schema and the compiled proto message class (e.g. field changed from scalar to message in a newer proto class while the DDL stayed scalar); using mismatched flink-protobuf and protobuf-java versions.","solutions":["Check the message text: it prints fd.getJavaType() — find that field in the .proto and compare with the DDL column type.","Recompile/regenerate the Java proto classes and ensure the DDL matches the current field kinds (message fields need ROW(...) columns).","Align flink-protobuf and protobuf-java versions with the Flink distribution.","If types genuinely match, report a JIRA with the schema — the dispatch should not have routed here."],"exampleFix":"// proto: message Outer { Inner inner = 1; }\n-- before\ninner INT,\n-- after\ninner ROW<...>","handlingStrategy":"validation","validationCode":"if (fd.getJavaType() == FieldDescriptor.JavaType.MESSAGE || fd.getJavaType() == FieldDescriptor.JavaType.ENUM) {\n    // must be routed to row/enum deserializer, not simple\n    assert !(PbFormatUtils.isSimpleType(type)) : \"misrouted field \" + fd.getName();\n}","typeGuard":null,"tryCatchPattern":"try {\n    deserializer = PbCodegenDeserializeFactory.getPbCodegenDes(fd, type, ctx);\n} catch (PbCodegenException e) {\n    throw new RuntimeException(\"Field '\" + fd.getFullName() + \"' javaType=\" + fd.getJavaType(), e);\n}","preventionTips":["Keep DDL field kinds in lockstep with the .proto; regenerate and re-validate on every proto change.","Pin protobuf-java and flink-protobuf to compatible versions."],"tags":["protobuf","codegen","schema-mismatch"],"backgroundTag":null,"analyzedSha":"2f3c205e9266cb30240eb7f4fdab15cad629a70f","analyzedAt":"2026-08-14T08:48:24.518Z","schemaVersion":2},"datasetVersion":"2026-08-14T10:17:34.591Z"}