{"record":{"id":"f2cd627e2099b20c","repo":"apache/flink","slug":"cannot-terminate-a-standalone-cluster","errorCode":null,"errorMessage":"Cannot terminate a standalone cluster.","messagePattern":"Cannot terminate a standalone cluster\\.","errorType":"exception","errorClass":"UnsupportedOperationException","httpStatus":null,"severity":"warning","filePath":"flink-clients/src/main/java/org/apache/flink/client/deployment/StandaloneClusterDescriptor.java","lineNumber":73,"sourceCode":"    }\n\n    @Override\n    public ClusterClientProvider<StandaloneClusterId> deploySessionCluster(\n            ClusterSpecification clusterSpecification) {\n        throw new UnsupportedOperationException(\"Can't deploy a standalone cluster.\");\n    }\n\n    @Override\n    public ClusterClientProvider<StandaloneClusterId> deployApplicationCluster(\n            final ClusterSpecification clusterSpecification,\n            final ApplicationConfiguration applicationConfiguration) {\n        throw new UnsupportedOperationException(\n                \"Application Mode not supported by standalone deployments.\");\n    }\n\n    @Override\n    public void killCluster(StandaloneClusterId clusterId) throws FlinkException {\n        throw new UnsupportedOperationException(\"Cannot terminate a standalone cluster.\");\n    }\n\n    @Override\n    public void close() {\n        // nothing to do\n    }\n}\n","sourceCodeStart":55,"sourceCodeEnd":81,"githubUrl":"https://github.com/apache/flink/blob/2f3c205e9266cb30240eb7f4fdab15cad629a70f/flink-clients/src/main/java/org/apache/flink/client/deployment/StandaloneClusterDescriptor.java#L55-L81","documentation":"Thrown by StandaloneClusterDescriptor.killCluster as an UnsupportedOperationException. In a standalone deployment, the JobManager and TaskManager processes are started and stopped externally by the user (via start-cluster.sh / stop-cluster.sh or process management). Flink has no mechanism to terminate these processes through the ClusterDescriptor API because it does not own the process lifecycle.","triggerScenarios":"Calling killCluster programmatically on a StandaloneClusterDescriptor; using a generic shutdown routine that calls killCluster on any descriptor type.","commonSituations":"Generic orchestration code that handles cluster teardown uniformly; migration from managed deployments where killCluster was supported.","solutions":["Stop the standalone cluster externally: run stop-cluster.sh in FLINK_HOME/bin/","For programmatic shutdown, cancel/stop individual jobs via the ClusterClient API rather than killing the cluster","Switch to a managed deployment (YARN/K8s) if cluster-level termination is needed programmatically"],"exampleFix":"// before\nstandaloneDescriptor.killCluster(StandaloneClusterId.getInstance());\n\n// after\n// stop externally\nstop-cluster.sh  // from FLINK_HOME/bin/","handlingStrategy":"type-guard","validationCode":null,"typeGuard":"// Guard against calling killCluster on a standalone descriptor:\nif (descriptor instanceof StandaloneClusterDescriptor) {\n    LOG.warn(\"Cannot kill a standalone cluster via API. Use stop-cluster.sh externally.\");\n    return;\n}","tryCatchPattern":"try {\n    descriptor.killCluster(clusterId);\n} catch (UnsupportedOperationException e) {\n    LOG.warn(\"Cluster termination not supported via API for this deployment: {}\", e.getMessage());\n}","preventionTips":["Handle standalone cluster shutdown externally via stop-cluster.sh","Branch teardown logic on the descriptor type","Use managed deployments if programmatic cluster termination is needed"],"tags":["deployment","standalone","unsupported-operation"],"backgroundTag":null,"analyzedSha":"2f3c205e9266cb30240eb7f4fdab15cad629a70f","analyzedAt":"2026-08-14T08:48:24.518Z","schemaVersion":2},"datasetVersion":"2026-08-14T10:17:34.591Z"}