apache/flink · error · PbCodegenException
do not support field type:
Error message
do not support field type:
What it means
getTypeStrFromProto maps a proto field's JavaType to a Java type string used in generated code. The default branch throws for unhandled JavaTypes — typically MESSAGE or ENUM landing here, since the caller should have routed those elsewhere. A throw here indicates an inconsistent dispatch path (bug) or a protobuf runtime version exposing types this flink-protobuf build does not know.
Source
Thrown at flink-formats/flink-protobuf/src/main/java/org/apache/flink/formats/protobuf/util/PbCodegenUtils.java:126
typeStr = "String";
break;
case ENUM:
typeStr = PbFormatUtils.getFullJavaName(fd.getEnumType());
break;
case FLOAT:
typeStr = "Float";
break;
case DOUBLE:
typeStr = "Double";
break;
case BYTE_STRING:
typeStr = "ByteString";
break;
case BOOLEAN:
typeStr = "Boolean";
break;
default:
throw new PbCodegenException("do not support field type: " + fd.getJavaType());
}
if (isList) {
return "List<" + typeStr + ">";
} else {
return typeStr;
}
}
/**
* Get java type str from {@link LogicalType} which directly fetched from flink type.
*
* @return The returned code phrase will be used as java type str in codegen sections.
*/
public static String getTypeStrFromLogicType(LogicalType type) {
switch (type.getTypeRoot()) {
case INTEGER:
return "int";
case BIGINT:View on GitHub (pinned to 2f3c205e92)
Solutions
- Diff the DDL against the current .proto; make message fields ROW(...) and enum fields INT/VARCHAR.
- Regenerate the protobuf Java classes and ensure the pipeline compiles against them.
- Pin compatible flink-protobuf and protobuf-java versions (do not override in user jars).
- If consistent, report a JIRA — this default should be unreachable for valid dispatch.
Defensive patterns
Strategy: validation
Validate before calling
Set<FieldDescriptor.JavaType> supported = EnumSet.of(
FieldDescriptor.JavaType.INT, FieldDescriptor.JavaType.LONG,
FieldDescriptor.JavaType.FLOAT, FieldDescriptor.JavaType.DOUBLE,
FieldDescriptor.JavaType.BOOLEAN, FieldDescriptor.JavaType.BYTE_STRING,
FieldDescriptor.JavaType.STRING, FieldDescriptor.JavaType.ENUM);
if (!supported.contains(fd.getJavaType())) fail(fd); Prevention
- Regenerate proto Java classes whenever the .proto changes and rebuild the job.
- Avoid mixing protobuf-java versions between the proto classes and the Flink runtime.
When it happens
Trigger: A message/enum proto field being processed where only simple java types are expected, e.g. an array of messages whose element type string is requested from the wrong branch.
Common situations: Schema mismatch between DDL and proto class (message field declared as scalar); mismatched protobuf-java/flink-protobuf versions after an upgrade.
Related errors
- Do not support flink type:
- Illegal type for protobuf enum, only char/vachar/int/bigint
- Unsupported protobuf simple type:
- Do not support flink data type:
- Unsupported data type in schema:
AI-assisted analysis of apache/flink@2f3c205e92 (2026-08-14).
Data as JSON: /api/errors/eb0a4bfe3499dff3.
Report an issue: GitHub.