apache/dolphinscheduler · error · TaskDispatchException

"Dispatch LogicTask to %s failed, response is: %s" (formatte

Error message

"Dispatch LogicTask to %s failed, response is: %s" (formatted with taskExecutionContext.getHost(), logicTaskDispatchResponse)

What it means

The master dispatches a logic task (e.g. dependent, condition, switch) to itself via RPC and this error means the master-side executor replied with an unsuccessful TaskExecutorDispatchResponse. TaskDispatchException is thrown by LogicTaskExecutorClientDelegator.dispatch after the RPC round-trip succeeds but the response reports failure, so the target master accepted the request but could not start the task.

Source

Thrown at dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/engine/task/client/LogicTaskExecutorClientDelegator.java:65

public class LogicTaskExecutorClientDelegator implements ITaskExecutorClientDelegator {

    @Autowired
    private MasterConfig masterConfig;

    @Override
    public void dispatch(final ITaskExecution taskExecution) throws TaskDispatchException {
        final String logicTaskExecutorAddress = masterConfig.getMasterAddress();
        final TaskExecutionContext taskExecutionContext = taskExecution.getTaskExecutionContext();

        taskExecutionContext.setHost(logicTaskExecutorAddress);
        taskExecution.getTaskInstance().setHost(logicTaskExecutorAddress);

        final TaskExecutorDispatchResponse logicTaskDispatchResponse = Clients
                .withService(ILogicTaskExecutorOperator.class)
                .withHost(logicTaskExecutorAddress)
                .dispatchTask(TaskExecutorDispatchRequest.of(taskExecutionContext));
        if (!logicTaskDispatchResponse.isDispatchSuccess()) {
            throw new TaskDispatchException(
                    String.format("Dispatch LogicTask to %s failed, response is: %s",
                            taskExecutionContext.getHost(), logicTaskDispatchResponse));
        }
    }

    @Override
    public boolean reassignMasterHost(final ITaskExecution taskExecution) {
        // The Logic Task doesn't support take-over, since the logic task is not executed on the worker.
        return false;
    }

    @Override
    public void pause(final ITaskExecution taskExecution) {
        final TaskInstance taskInstance = taskExecution.getTaskInstance();
        final String executorHost = taskInstance.getHost();
        final String taskName = taskInstance.getName();
        checkArgument(StringUtils.isNotEmpty(executorHost), "Executor host is empty");

View on GitHub (pinned to 02eac45a1b)

Solutions

  1. Inspect the full log line: the TaskExecutorDispatchResponse in the message usually carries the rejection reason; fix the underlying cause it reports
  2. Verify the master process is healthy and not shutting down or out of threads/memory; restart or scale the master if needed
  3. Check that the task plugin for the logic task type is installed and its parameters are valid
  4. Retry the workflow instance; transient master-side failures typically succeed on re-run

Example fix

// before
// dispatch failure surfaces only at runtime as TaskDispatchException
// after
// pre-check before triggering the workflow
if (!masterConfig.getMasterAddress().equals(host)) {
    throw new IllegalStateException("Logic tasks must run on the master: " + masterConfig.getMasterAddress());
}
Defensive patterns

Strategy: try-catch

Validate before calling

if (!masterConfig.getMasterAddress().equals(taskExecutionContext.getHost())) {
    throw new IllegalStateException("Logic task host must be the master address");
}

Type guard

boolean isLogicTaskDispatchSuccessful(TaskExecutorDispatchResponse r) { return r != null && r.isDispatchSuccess(); }

Try / catch

try {
    taskExecutorClient.dispatch(taskExecution);
} catch (TaskDispatchException e) {
    log.error("Logic task dispatch to {} failed: {}", taskExecution.getTaskExecutionContext().getHost(), e.getMessage());
    // mark task failed or retry per workflow failure strategy
}

Prevention

When it happens

Trigger: Clients.withService(ILogicTaskExecutorOperator.class).withHost(masterAddress).dispatchTask(...) returns a response whose isDispatchSuccess() is false, i.e. the local logic-task executor rejected or failed to initialize the dispatched TaskExecutionContext.

Common situations: Master is overloaded or shutting down while accepting dispatches; the task plugin for the logic task fails to initialize (missing plugin jar, bad params); a version-mismatched master handling a forwarded request; resource/thread exhaustion in the logic task executor.

Related errors


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