apache/dolphinscheduler · error · GrpcParserException
grpc task method name is invalid
Error message
grpc task method name is invalid
What it means
MethodName parses the task's method identifier string in the form '<serviceName>.<rpcName>' (split on GrpcConstants.SERVICE_METHOD_SEPERATOR). If the string does not split into exactly one or two non-empty parts, the constructor throws GrpcParserException('grpc task method name is invalid') without constructing a service/rpc pair. Note the check is structural: a well-formed-looking name can still pass and fail later with 'cannot find service/method'.
Source
Thrown at dolphinscheduler-task-plugin/dolphinscheduler-task-grpc/src/main/java/org/apache/dolphinscheduler/plugin/task/grpc/protobufjs/GrpcDynamicService.java:150
&& !methodDesc.isClientStreaming()) {
return MethodDescriptor.MethodType.SERVER_STREAMING;
} else if (!methodDesc.isServerStreaming()) {
return MethodDescriptor.MethodType.CLIENT_STREAMING;
} else {
return MethodDescriptor.MethodType.BIDI_STREAMING;
}
}
public static class MethodName {
@Getter
String serviceName = null;
@Getter
String rpcName = null;
public MethodName(String methodNameWithService) {
if (!checkMethodName(methodNameWithService))
throw new GrpcParserException("grpc task method name is invalid");
}
private boolean checkMethodName(String methodNameWithService) {
String[] path = methodNameWithService.split(GrpcConstants.SERVICE_METHOD_SEPERATOR);
if (path.length == 0)
return false;
if (path.length == 1)
rpcName = path[0];
if (path.length == 2) {
serviceName = path[0];
rpcName = path[1];
} else {
return false;
}
if (serviceName == null || serviceName.isEmpty()) {
return false;
}
return rpcName != null && !rpcName.isEmpty();View on GitHub (pinned to 02eac45a1b)
Solutions
- Use exactly 'ServiceName.RpcName' (one separator, both parts non-empty), e.g. 'Greeter.SayHello'.
- Strip package prefixes and URL decorations: '/package.Greeter/SayHello' → 'Greeter.SayHello'.
- Trim whitespace and verify the task-form field is not empty or parameter-substituted to blank.
- If the proto uses nested services, use only the service's simple name; the descriptor lookup uses findServiceByName on the simple name.
Example fix
// before
new GrpcDynamicService.MethodName("/example.Greeter/SayHello"); // invalid
// after
new GrpcDynamicService.MethodName("Greeter.SayHello"); // ServiceName.RpcName Defensive patterns
Strategy: validation
Validate before calling
// Validate before constructing MethodName
boolean isValidMethodName(String s) {
if (s == null) return false;
String[] p = s.split("\\.");
return p.length == 2 && !p[0].isEmpty() && !p[1].isEmpty();
} Try / catch
try {
service.call("Greeter.SayHello", json, 5000);
} catch (GrpcParserException e) {
if (e.getMessage().contains("method name is invalid")) {
log.error("Use ServiceName.RpcName format, e.g. Greeter.SayHello, got: {}", userInput);
}
} Prevention
- Always format as ServiceName.RpcName with a single dot separator
- Strip '/package.Svc/Method' URL-style names down to 'Svc.Method'
- Trim user input and guard against blank values from parameter substitution
- List available services/methods from the descriptor and use a dropdown instead of free text where possible
When it happens
Trigger: Passing a methodNameWithService to call() or mergeJSON() that is null/empty, contains more than one separator (e.g. 'a.b.c'), or contains only the separator ('.'), or has an empty service or rpc part (e.g. '.SayHello', 'Greeter.').
Common situations: User typed a full gRPC URL like '/package.Svc/Method' or 'package.Svc.Method' (three parts) in the task form instead of 'Svc.Method'; copy-paste with trailing dot; empty field because the workflow parameter substituted to blank.
Understand the failure class
Background: "invalid id" errors: invalid identifier format — why libraries reject IDs before lookup, and how to fix them — this error's family across 37 libraries.
Related errors
- gRPC task params is not valid, method definition may not cor
- grpc unrecogenized condition %s
- grpc check condition %s not supported
- cannot merge json message to protobuf definition type <messa
- grpc exception: Unrecognized field label:
AI-assisted analysis of apache/dolphinscheduler@02eac45a1b (2026-09-06).
Data as JSON: /api/errors/0277353117a3f0a0.
Report an issue: GitHub.