apache/flink · warning · UnsupportedOperationException

Cannot terminate a standalone cluster.

Error message

Cannot terminate a standalone cluster.

What it means

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.

Source

Thrown at flink-clients/src/main/java/org/apache/flink/client/deployment/StandaloneClusterDescriptor.java:73

    }

    @Override
    public ClusterClientProvider<StandaloneClusterId> deploySessionCluster(
            ClusterSpecification clusterSpecification) {
        throw new UnsupportedOperationException("Can't deploy a standalone cluster.");
    }

    @Override
    public ClusterClientProvider<StandaloneClusterId> deployApplicationCluster(
            final ClusterSpecification clusterSpecification,
            final ApplicationConfiguration applicationConfiguration) {
        throw new UnsupportedOperationException(
                "Application Mode not supported by standalone deployments.");
    }

    @Override
    public void killCluster(StandaloneClusterId clusterId) throws FlinkException {
        throw new UnsupportedOperationException("Cannot terminate a standalone cluster.");
    }

    @Override
    public void close() {
        // nothing to do
    }
}

View on GitHub (pinned to 2f3c205e92)

Solutions

  1. Stop the standalone cluster externally: run stop-cluster.sh in FLINK_HOME/bin/
  2. For programmatic shutdown, cancel/stop individual jobs via the ClusterClient API rather than killing the cluster
  3. Switch to a managed deployment (YARN/K8s) if cluster-level termination is needed programmatically

Example fix

// before
standaloneDescriptor.killCluster(StandaloneClusterId.getInstance());

// after
// stop externally
stop-cluster.sh  // from FLINK_HOME/bin/
Defensive patterns

Strategy: type-guard

Type guard

// Guard against calling killCluster on a standalone descriptor:
if (descriptor instanceof StandaloneClusterDescriptor) {
    LOG.warn("Cannot kill a standalone cluster via API. Use stop-cluster.sh externally.");
    return;
}

Try / catch

try {
    descriptor.killCluster(clusterId);
} catch (UnsupportedOperationException e) {
    LOG.warn("Cluster termination not supported via API for this deployment: {}", e.getMessage());
}

Prevention

When it happens

Trigger: Calling killCluster programmatically on a StandaloneClusterDescriptor; using a generic shutdown routine that calls killCluster on any descriptor type.

Common situations: Generic orchestration code that handles cluster teardown uniformly; migration from managed deployments where killCluster was supported.

Related errors


AI-assisted analysis of apache/flink@2f3c205e92 (2026-08-14). Data as JSON: /api/errors/f2cd627e2099b20c. Report an issue: GitHub.