apache/dolphinscheduler · error · ServiceException
{joined failure messages, e.g. Failed do action <executeType
Error message
{joined failure messages, e.g. Failed do action <executeType> on workflowInstance: <id>reason: <error>} What it means
ExecutorController.batchControlWorkflowInstance applies an action (executeType) to each workflow instance in the batch, collecting per-instance errors. If any instance failed, it joins all 'Failed do action <executeType> on workflowInstance: <id>reason: <error>' lines with newlines and throws a single ServiceException. This is an aggregate failure message, not one specific cause.
Source
Thrown at dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/ExecutorController.java:356
public Result<Void> batchControlWorkflowInstance(@RequestAttribute(value = Constants.SESSION_USER) User loginUser,
@RequestParam("workflowInstanceIds") String workflowInstanceIds,
@RequestParam("executeType") ExecuteType executeType) {
String[] workflowInstanceIdArray = workflowInstanceIds.split(Constants.COMMA);
List<String> errorMessage = new ArrayList<>();
for (String strWorkflowInstanceId : workflowInstanceIdArray) {
int workflowInstanceId = Integer.parseInt(strWorkflowInstanceId);
try {
execService.controlWorkflowInstance(loginUser, workflowInstanceId, executeType);
log.info("Success do action {} on workflowInstance: {}", executeType, workflowInstanceId);
} catch (Exception e) {
errorMessage.add("Failed do action " + executeType + " on workflowInstance: " + workflowInstanceId
+ "reason: " + e.getMessage());
log.error("Failed do action {} on workflowInstance: {}, error: {}", executeType, workflowInstanceId, e);
}
}
if (org.apache.commons.collections4.CollectionUtils.isNotEmpty(errorMessage)) {
throw new ServiceException(String.join("\n", errorMessage));
}
return Result.success();
}
/**
* execute task instance
*
* @param loginUser login user
* @param projectCode project code
* @param code taskDefinitionCode
* @param version taskDefinitionVersion
* @param warningGroupId warning group id
* @param workerGroup worker group
* @return start task result code
*/
@Operation(summary = "startTaskInstance", description = "RUN_TASK_INSTANCE_NOTES")
@Parameters({
@Parameter(name = "version", description = "VERSION", schema = @Schema(implementation = int.class, example = "1")),View on GitHub (pinned to 02eac45a1b)
Solutions
- Read the per-line reasons in the thrown message to see which instance IDs failed and why, then retry only the failed ones.
- Before batching, verify each instance is in a state that allows the action (e.g. only RUNNING instances can be stopped).
- Reduce batch size and inspect/refresh the instance list so IDs are current and visible to the calling user.
Example fix
// before: blind batch execClient.batchStop(allInstanceIds); // after: filter to controllable instances first List<Integer> stoppable = ids.stream().filter(id -> stateOf(id) == RUNNING).collect(toList()); execClient.batchStop(stoppable);
Defensive patterns
Strategy: try-catch
Validate before calling
List<Integer> eligible = instanceIds.stream()
.filter(id -> {
WorkflowInstance wi = find(id);
return wi != null && wi.getState().isRunning() && canWrite(wi.getProjectCode());
}).collect(toList()); Try / catch
try {
executorController.batchControlWorkflowInstance(...);
} catch (ServiceException e) {
Set<Integer> failed = Arrays.stream(e.getMessage().split("\n"))
.map(l -> l.replaceAll(".*workflowInstance: (\\d+).*", "$1"))
.map(Integer::valueOf)
.collect(toSet());
log.warn("Retrying batch without failed ids: {}", failed);
} Prevention
- Refresh instance state immediately before batch actions.
- Batch only instances visible in the target project and controllable by the user.
- Parse the aggregated message to isolate failed instance IDs instead of retrying the whole batch.
When it happens
Trigger: Batch endpoints (e.g. /executor/batch-instance-execute) where at least one target workflow instance cannot be controlled — instance already finished, instance not found, state does not permit the action, or permission denied — producing at least one entry in errorMessage.
Common situations: Batch-stopping instances that already completed between selection and execution; operating on instances belonging to another project/user; stale UI lists referencing deleted instances.
Related errors
- COPY_WORKFLOW_DEFINITION_ERROR
- MOVE_WORKFLOW_DEFINITION_ERROR
- 10001
- The execType: {execType} is invalid
- The releaseState {releaseState} is illegal, please check it.
AI-assisted analysis of apache/dolphinscheduler@02eac45a1b (2026-09-06).
Data as JSON: /api/errors/dd957e016b985f71.
Report an issue: GitHub.