{"record":{"id":"e510ee4510e4cb4c","repo":"apache/dolphinscheduler","slug":"grpc-exception-unrecognized-field-label","errorCode":null,"errorMessage":"grpc exception: Unrecognized field label: ","messagePattern":"grpc exception: Unrecognized field label: ","errorType":"exception","errorClass":"GrpcParserException","httpStatus":null,"severity":"error","filePath":"dolphinscheduler-task-plugin/dolphinscheduler-task-grpc/src/main/java/org/apache/dolphinscheduler/plugin/task/grpc/protobufjs/types/FieldType.java","lineNumber":98,"sourceCode":"    }\n\n    public static DescriptorProtos.FieldDescriptorProto.Builder parseField(String selfName,\n                                                                           org.apache.dolphinscheduler.plugin.task.grpc.protobufjs.mapping.Field field) {\n        DescriptorProtos.FieldDescriptorProto.Builder fieldDescriptorProtoBuilder =\n                DescriptorProtos.FieldDescriptorProto.newBuilder()\n                        .setName(selfName)\n                        .setNumber(field.getId());\n\n        enumOptions(fieldDescriptorProtoBuilder, field.getOptions());\n\n        JsonNode rule = field.getRule();\n        if (!isNull(rule) && rule.isTextual()) {\n            String label = rule.asText();\n            try {\n                fieldDescriptorProtoBuilder\n                        .setLabel(FieldType.parseFieldLabel(label));\n            } catch (IllegalArgumentException e) {\n                throw new GrpcParserException(\"grpc exception: Unrecognized field label: \" + label, e);\n            }\n        }\n        try {\n            fieldDescriptorProtoBuilder\n                    .setType(FieldType.parseFieldType(field.getType()));\n        } catch (IllegalArgumentException e) {\n            fieldDescriptorProtoBuilder.setTypeName(field.getType());\n        }\n        return fieldDescriptorProtoBuilder;\n    }\n\n    private static void enumOptions(DescriptorProtos.FieldDescriptorProto.Builder fieldDescriptorProtoBuilder,\n                                    Map<String, Object> options) {\n        if (!isNull(options) && !isNull(options.get(\"proto3_optional\")) && ((boolean) options.get(\"proto3_optional\"))) {\n            fieldDescriptorProtoBuilder.setProto3Optional(true);\n        }\n    }\n}","sourceCodeStart":80,"sourceCodeEnd":116,"githubUrl":"https://github.com/apache/dolphinscheduler/blob/02eac45a1b6676e639fcbfb4be2243de5771b05d/dolphinscheduler-task-plugin/dolphinscheduler-task-grpc/src/main/java/org/apache/dolphinscheduler/plugin/task/grpc/protobufjs/types/FieldType.java#L80-L116","documentation":"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).","triggerScenarios":"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.","commonSituations":"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.","solutions":["Correct the label in the descriptor JSON to one of the accepted labels: 'optional', 'required', or 'repeated'.","Remove the label field entirely if it is proto3 (proto3 fields typically have no explicit label in descriptors).","Regenerate the descriptor JSON with the same protobufjs toolchain version the plugin was built against (pbjs).","Diff the failing field JSON against a known-good descriptor generated by pbjs for the same proto."],"exampleFix":"// before (descriptor json)\n{\"name\":\"items\",\"label\":\"repat\",\"type\":\"string\"}\n// after\n{\"name\":\"items\",\"label\":\"repeated\",\"type\":\"string\"}","handlingStrategy":"validation","validationCode":"// Pre-check every field label in the descriptor JSON\njava.util.Set<String> ok = java.util.Set.of(\"optional\", \"required\", \"repeated\");\nboolean labelsValid(com.fasterxml.jackson.databind.JsonNode msgType) {\n    for (var f : msgType.get(\"fields\")) {\n        var label = f.get(\"label\");\n        if (label != null && label.isTextual() && !ok.contains(label.asText())) return false;\n    }\n    return true;\n}","typeGuard":null,"tryCatchPattern":"try {\n    FieldType.parseField(fieldNode, builder);\n} catch (GrpcParserException e) {\n    if (e.getMessage().startsWith(\"grpc exception: Unrecognized field label\")) {\n        log.error(\"Bad label in descriptor json: {}\", e.getMessage());\n    }\n}","preventionTips":["Only feed descriptor JSON produced by a compatible pbjs/protobufjs version","Never hand-edit label values in descriptor JSON","Validate the descriptor JSON against the protobufjs descriptor schema before loading","For proto3 files, prefer generated descriptors without explicit labels"],"tags":["grpc","protobuf","descriptor","validation"],"backgroundTag":"invalid-enum-value","analyzedSha":"02eac45a1b6676e639fcbfb4be2243de5771b05d","analyzedAt":"2026-09-06T17:43:00.555Z","contentChangedAt":"2026-09-06T17:43:00.555Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}