{"record":{"id":"1c81b3b596528fff","repo":"apache/dolphinscheduler","slug":"grpc-task-params-is-not-valid-method-definition-m","errorCode":null,"errorMessage":"gRPC task params is not valid, method definition may not corresponds to message or method name is invalid","messagePattern":"gRPC task params is not valid, method definition may not corresponds to message or method name is invalid","errorType":"validation","errorClass":"GrpcTaskException","httpStatus":null,"severity":"error","filePath":"dolphinscheduler-task-plugin/dolphinscheduler-task-grpc/src/main/java/org/apache/dolphinscheduler/plugin/task/grpc/GrpcTask.java","lineNumber":67,"sourceCode":"    private TaskExecutionContext taskExecutionContext;\n\n    /**\n     * constructor\n     *\n     * @param taskExecutionContext taskExecutionContext\n     */\n    protected GrpcTask(TaskExecutionContext taskExecutionContext) {\n        super(taskExecutionContext);\n        this.taskExecutionContext = taskExecutionContext;\n    }\n\n    @Override\n    public void init() {\n        this.grpcParameters = JSONUtils.parseObject(taskExecutionContext.getTaskParams(), GrpcParameters.class);\n        log.info(\"Initialize gRPC task params: {}\", JSONUtils.toPrettyJsonString(grpcParameters));\n\n        if (grpcParameters == null || !grpcParameters.checkParameters()) {\n            throw new GrpcTaskException(\n                    \"gRPC task params is not valid, method definition may not corresponds to message or method name is invalid\");\n        }\n    }\n\n    @Override\n    public void handle(TaskCallBack taskCallBack) throws TaskException {\n        try {\n            ManagedChannel channel;\n            if (grpcParameters.getChannelCredentialType() == GrpcCredentialType.TLS_DEFAULT) {\n                TlsChannelCredentials creds = (TlsChannelCredentials) TlsChannelCredentials.create();\n                channel = GrpcDynamicService.ChannelFactory.createChannel(grpcParameters.getUrl(), creds);\n            } else {\n                channel = GrpcDynamicService.ChannelFactory.createChannel(grpcParameters.getUrl());\n            }\n            Descriptors.FileDescriptor fileDesc =\n                    JSONDescriptorHelper.fileDescFromJSON(grpcParameters.getGrpcServiceDefinitionJSON());\n            GrpcDynamicService stubService = new GrpcDynamicService(channel, fileDesc);\n            DynamicMessage message = stubService.call(grpcParameters.getMethodName(), grpcParameters.getMessage(),","sourceCodeStart":49,"sourceCodeEnd":85,"githubUrl":"https://github.com/apache/dolphinscheduler/blob/02eac45a1b6676e639fcbfb4be2243de5771b05d/dolphinscheduler-task-plugin/dolphinscheduler-task-grpc/src/main/java/org/apache/dolphinscheduler/plugin/task/grpc/GrpcTask.java#L49-L85","documentation":"GrpcTask.init() parses taskParams into GrpcParameters and validates them via checkParameters(), which verifies the proto method definition corresponds to the configured message and method name. Failure throws GrpcTaskException('gRPC task params is not valid, ...'). This prevents invoking a gRPC endpoint with an unusable/inconsistent method definition.","triggerScenarios":"grpcParameters null or checkParameters() false: missing url/methodName, proto descriptor not found, or methodName not present in the loaded proto file's service definition.","commonSituations":"Typo in method name vs the uploaded .proto file; proto file not attached to the task; proto file updated/renamed messages while the task definition still references the old names.","solutions":["Verify the methodName matches a method declared in the attached proto file's service","Re-upload/select the correct .proto file in the task definition and confirm message names match","Ensure url and other required gRPC parameters are non-empty","Re-save and re-run the task so params are re-parsed"],"exampleFix":"// before\n{\"url\":\"localhost:50051\",\"methodName\":\"Foo/Bar\"}\n// after\n{\"url\":\"localhost:50051\",\"methodName\":\"com.example.MyService/GetItem\",\"protoFile\":\"my_service.proto\"}","handlingStrategy":"validation","validationCode":"GrpcParameters p = JSONUtils.parseObject(taskParams, GrpcParameters.class);\nif (p == null || !p.checkParameters()) {\n    throw new IllegalArgumentException(\"grpc params invalid: check url, methodName and attached proto file\");\n}","typeGuard":"boolean isValidGrpcParams(String json) {\n    GrpcParameters p = JSONUtils.parseObject(json, GrpcParameters.class);\n    return p != null && p.checkParameters();\n}","tryCatchPattern":"try {\n    task.init();\n} catch (GrpcTaskException e) {\n    log.error(\"grpc params invalid: {}\", e.getMessage());\n    // correct proto/methodName in the task definition\n}","preventionTips":["Verify methodName against the service definition in the attached proto file","Re-upload the proto file after any message/service rename","Keep url non-empty and reachable from workers","Re-save tasks via UI to validate params at edit time"],"tags":["grpc","protobuf","task-params","validation"],"backgroundTag":"schema-validation-failed","analyzedSha":"02eac45a1b6676e639fcbfb4be2243de5771b05d","analyzedAt":"2026-09-06T17:43:00.555Z","contentChangedAt":"2026-09-06T17:43:00.555Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}