{"record":{"id":"3f5f4f193330a2f7","repo":"apache/dolphinscheduler","slug":"workflowinstance-s-stop-failed-s","errorCode":null,"errorMessage":"WorkflowInstance: %s stop failed: %s","messagePattern":"WorkflowInstance: (.+?) stop failed: (.+?)","errorType":"exception","errorClass":"ServiceException","httpStatus":null,"severity":"error","filePath":"dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/executor/workflow/StopWorkflowInstanceExecutorDelegate.java","lineNumber":101,"sourceCode":"            return null;\n        });\n        log.info(\"Update workflow instance {} state from: {} to {} success\",\n                workflowInstance.getName(),\n                workflowInstance.getState().name(),\n                WorkflowExecutionStatus.STOP.name());\n    }\n\n    void stopInMaster(WorkflowInstance workflowInstance) {\n        try {\n            final WorkflowInstanceStopResponse stopResponse = Clients\n                    .withService(IWorkflowControlClient.class)\n                    .withHost(workflowInstance.getHost())\n                    .stopWorkflowInstance(new WorkflowInstanceStopRequest(workflowInstance.getId()));\n\n            if (stopResponse != null && stopResponse.isSuccess()) {\n                log.info(\"WorkflowInstance: {} stop success\", workflowInstance.getName());\n            } else {\n                throw new ServiceException(\n                        \"WorkflowInstance: \" + workflowInstance.getName() + \" stop failed: \" + stopResponse);\n            }\n        } catch (ServiceException e) {\n            throw e;\n        } catch (Exception e) {\n            throw new ServiceException(\n                    String.format(\"WorkflowInstance: %s stop failed\", workflowInstance.getName()), e);\n        }\n    }\n\n    public static class StopWorkflowInstanceOperation {\n\n        private final StopWorkflowInstanceExecutorDelegate stopWorkflowInstanceExecutorDelegate;\n\n        private WorkflowInstance workflowInstance;\n\n        private User executeUser;\n","sourceCodeStart":83,"sourceCodeEnd":119,"githubUrl":"https://github.com/apache/dolphinscheduler/blob/02eac45a1b6676e639fcbfb4be2243de5771b05d/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/executor/workflow/StopWorkflowInstanceExecutorDelegate.java#L83-L119","documentation":"Thrown by StopWorkflowInstanceExecutorDelegate.stopInMaster when the master's stopWorkflowInstance response is null or reports success=false. The stop request reached the instance's host master but the stop operation failed; the whole response object is appended to the message.","triggerScenarios":"Calling stopWorkflowInstance on the host at workflowInstance.getHost() and receiving a null response (master restarted/changed host) or a failed response (instance not found on that master, stop command rejected, task kill failed).","commonSituations":"Master failover after the instance host was recorded — the old host is gone so the RPC fails; instance already finished on the master side; master under heavy load timing out; kill operation failing on a non-killable task type.","solutions":["Check whether the instance host still exists (master may have failed over); wait for failover to reassign or stop the instance on the new host","Read the appended stopResponse to see the master-side failure reason","Retry the stop once the master is stable","If the master is permanently gone, force the instance to a final state via DB and clean up","Check master logs for the stop/kill failure details"],"exampleFix":"// before\n.withHost(workflowInstance.getHost())\n    .stopWorkflowInstance(new WorkflowInstanceStopRequest(workflowInstance.getId()));\n// after\n// verify host still registered before RPC\nif (!registryClient.serverExists(RegistryNodeType.MASTER, workflowInstance.getHost())) {\n    throw new ServiceException(\"Host \" + workflowInstance.getHost() + \" no longer active; wait for failover\");\n}","handlingStrategy":"retry","validationCode":"boolean hostAlive = registryClient.serverExists(RegistryNodeType.MASTER, instance.getHost());\nif (!hostAlive) { throw new IllegalStateException(\"Instance host master is down; wait for failover\"); }","typeGuard":null,"tryCatchPattern":"try {\n    delegate.execute(op);\n} catch (ServiceException e) {\n    log.error(\"Stop failed: {}\", e.getMessage(), e);\n    // check failover state, retry or force-finalize in DB\n}","preventionTips":["Verify the instance host master is still registered before stop","Enable master failover so hosts stay consistent","Retry stop after transient master failures","Keep master RPC timeouts tuned for load"],"tags":["workflow","master-server","stop","rpc-response"],"backgroundTag":"api-error-response","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"}