apache/dolphinscheduler · error · GrpcParserException

grpc exception: Unrecognized field label:

Error message

grpc exception: Unrecognized field label: 

What it means

FieldType.parseField converts a protobufjs JSON field descriptor into a FieldDescriptorProto. When the JSON 'label' string (e.g. 'optional', 'required', 'repeated') is not a recognized field label, parseFieldLabel throws IllegalArgumentException, which is wrapped as GrpcParserException('grpc exception: Unrecognized field label: ' + label).

Source

Thrown at dolphinscheduler-task-plugin/dolphinscheduler-task-grpc/src/main/java/org/apache/dolphinscheduler/plugin/task/grpc/protobufjs/types/FieldType.java:98

    }

    public static DescriptorProtos.FieldDescriptorProto.Builder parseField(String selfName,
                                                                           org.apache.dolphinscheduler.plugin.task.grpc.protobufjs.mapping.Field field) {
        DescriptorProtos.FieldDescriptorProto.Builder fieldDescriptorProtoBuilder =
                DescriptorProtos.FieldDescriptorProto.newBuilder()
                        .setName(selfName)
                        .setNumber(field.getId());

        enumOptions(fieldDescriptorProtoBuilder, field.getOptions());

        JsonNode rule = field.getRule();
        if (!isNull(rule) && rule.isTextual()) {
            String label = rule.asText();
            try {
                fieldDescriptorProtoBuilder
                        .setLabel(FieldType.parseFieldLabel(label));
            } catch (IllegalArgumentException e) {
                throw new GrpcParserException("grpc exception: Unrecognized field label: " + label, e);
            }
        }
        try {
            fieldDescriptorProtoBuilder
                    .setType(FieldType.parseFieldType(field.getType()));
        } catch (IllegalArgumentException e) {
            fieldDescriptorProtoBuilder.setTypeName(field.getType());
        }
        return fieldDescriptorProtoBuilder;
    }

    private static void enumOptions(DescriptorProtos.FieldDescriptorProto.Builder fieldDescriptorProtoBuilder,
                                    Map<String, Object> options) {
        if (!isNull(options) && !isNull(options.get("proto3_optional")) && ((boolean) options.get("proto3_optional"))) {
            fieldDescriptorProtoBuilder.setProto3Optional(true);
        }
    }
}

View on GitHub (pinned to 02eac45a1b)

Solutions

  1. Correct the label in the descriptor JSON to one of the accepted labels: 'optional', 'required', or 'repeated'.
  2. Remove the label field entirely if it is proto3 (proto3 fields typically have no explicit label in descriptors).
  3. Regenerate the descriptor JSON with the same protobufjs toolchain version the plugin was built against (pbjs).
  4. Diff the failing field JSON against a known-good descriptor generated by pbjs for the same proto.

Example fix

// before (descriptor json)
{"name":"items","label":"repat","type":"string"}
// after
{"name":"items","label":"repeated","type":"string"}
Defensive patterns

Strategy: validation

Validate before calling

// Pre-check every field label in the descriptor JSON
java.util.Set<String> ok = java.util.Set.of("optional", "required", "repeated");
boolean labelsValid(com.fasterxml.jackson.databind.JsonNode msgType) {
    for (var f : msgType.get("fields")) {
        var label = f.get("label");
        if (label != null && label.isTextual() && !ok.contains(label.asText())) return false;
    }
    return true;
}

Try / catch

try {
    FieldType.parseField(fieldNode, builder);
} catch (GrpcParserException e) {
    if (e.getMessage().startsWith("grpc exception: Unrecognized field label")) {
        log.error("Bad label in descriptor json: {}", e.getMessage());
    }
}

Prevention

When it happens

Trigger: Parsing a .proto-derived JSON descriptor whose field object contains a label value outside the protobufjs set — e.g. a typo like 'repat', a proto3 field with an unexpected label, or a hand-edited descriptor JSON with a null/odd label string.

Common situations: Descriptor JSON generated by a different protobufjs/proto parser version emitting labels this parser doesn't accept; manual editing of the uploaded proto JSON; tools emitting 'repeated' spelled differently or extra qualifiers.

Understand the failure class

Background: Invalid enum value errors: "Unknown type", "Invalid scope", "must be one of" — when a string is not on the library's allowed list — this error's family across 23 libraries.

Related errors


AI-assisted analysis of apache/dolphinscheduler@02eac45a1b (2026-09-06). Data as JSON: /api/errors/e510ee4510e4cb4c. Report an issue: GitHub.