apache/dolphinscheduler · error · GrpcParserException

cannot find service <serviceName> from service definition

Error message

cannot find service <serviceName> from service definition

What it means

GrpcDynamicService.call() parses a 'ServiceName.rpcName' string, then looks up the service in the parsed proto FileDescriptor via findServiceByName(). When no service with that name exists in the loaded .proto definition, it throws GrpcParserException. This means the service part of the method string does not match any service declared in the proto file the task compiled.

Source

Thrown at dolphinscheduler-task-plugin/dolphinscheduler-task-grpc/src/main/java/org/apache/dolphinscheduler/plugin/task/grpc/protobufjs/GrpcDynamicService.java:57

import io.netty.channel.nio.NioEventLoopGroup;
import io.netty.channel.socket.nio.NioSocketChannel;

public class GrpcDynamicService {

    Descriptors.FileDescriptor fileDescriptor;
    ManagedChannel channel;

    public GrpcDynamicService(ManagedChannel channel, Descriptors.FileDescriptor fileDesc) {
        this.fileDescriptor = fileDesc;
        this.channel = channel;
    }

    public DynamicMessage call(String methodNameWithService, String messageJSON, long timeout) {
        MethodName methodNameData = new MethodName(methodNameWithService);
        Descriptors.ServiceDescriptor pServiceDescriptor =
                fileDescriptor.findServiceByName(methodNameData.getServiceName());
        if (isNull(pServiceDescriptor))
            throw new GrpcParserException(
                    "cannot find service <" + methodNameData.getServiceName() + "> from service definition");
        Descriptors.MethodDescriptor pMethodDescriptor =
                pServiceDescriptor.findMethodByName(methodNameData.getRpcName());
        if (isNull(pMethodDescriptor))
            throw new GrpcParserException("cannot find method <" + methodNameData.getRpcName() + "> from service <"
                    + methodNameData.getServiceName() + "> with method list: " + Arrays.toString(pServiceDescriptor
                            .getMethods().stream().map(Descriptors.MethodDescriptor::getName).toArray()));
        MethodDescriptor<DynamicMessage, DynamicMessage> methodDescriptor =
                methodFromProtobuf(pServiceDescriptor, pMethodDescriptor);
        Descriptors.Descriptor requestMessageType = pMethodDescriptor.getInputType();
        Descriptors.Descriptor responseMessageType = pMethodDescriptor.getOutputType();
        DynamicMessage.Builder requestBuilder = DynamicMessage.newBuilder(requestMessageType);
        DynamicMessage.Builder responseBuilder = DynamicMessage.newBuilder(responseMessageType);
        try {
            JsonFormat.parser().ignoringUnknownFields().merge(messageJSON, requestBuilder);
        } catch (InvalidProtocolBufferException ipbe) {
            throw new GrpcParserException(
                    "cannot merge json message to protobuf definition type <" + requestMessageType.getName() + ">",

View on GitHub (pinned to 02eac45a1b)

Solutions

  1. Check the service name in the methodNameWithService string ('Service.rpc') against the 'service X {...}' declarations in your .proto file and fix spelling/casing.
  2. Verify the task is configured with the .proto file that actually declares that service (proto file path config).
  3. List available services by iterating fileDescriptor.getServices() and use the exact getName() value.
  4. If the proto file changed, update the config to the new service name and re-run.

Example fix

// before
grpcTask.call("UserService.getUser", json, 3000); // proto declares 'UserSvc'
// after
grpcTask.call("UserSvc.getUser", json, 3000);
Defensive patterns

Strategy: validation

Validate before calling

boolean serviceExists = java.util.Arrays.stream(fileDescriptor.getServices())
    .anyMatch(s -> s.getName().equals(serviceName));
if (!serviceExists) {
    throw new IllegalArgumentException("Unknown service " + serviceName + "; available: "
        + java.util.Arrays.toString(fileDescriptor.getServices().stream()
            .map(s -> s.getName()).toArray()));
}

Try / catch

try {
    dynamicService.call(methodNameWithService, json, timeout);
} catch (GrpcParserException e) {
    if (e.getMessage().contains("cannot find service")) {
        // log available services and fail fast with a corrected method string
    }
    throw e;
}

Prevention

When it happens

Trigger: Calling GrpcDynamicService.call() with a methodNameWithService whose service name is misspelled, uses the wrong case, or refers to a service not declared in the .proto file loaded into fileDescriptor.

Common situations: Typo or wrong casing in the task's 'method' config field; the proto file was updated/renamed and the config still references the old service name; the wrong .proto file was configured so the target service lives in a different descriptor; nested/packaged service names where only the simple name is expected.

Understand the failure class

Background: 'Could not be found', 'does not exist', 'not found in database': the resource-not-found family when an ID, slug, key, or URI lookup comes back empty — this error's family across 20 libraries.

Related errors


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