apache/flink · error · UnsupportedOperationException
Can't deploy a standalone cluster.
Error message
Can't deploy a standalone cluster.
What it means
Thrown by StandaloneClusterDescriptor.deploySessionCluster as an UnsupportedOperationException. A standalone cluster by definition is an externally managed process (the user starts/stops the JobManager and TaskManager scripts directly). Flink's API cannot deploy a new session cluster into a standalone deployment because there is no orchestration layer — it can only connect to an already-running one via retrieve().
Source
Thrown at flink-clients/src/main/java/org/apache/flink/client/deployment/StandaloneClusterDescriptor.java:60
return "Standalone cluster at " + host + ":" + port;
}
@Override
public ClusterClientProvider<StandaloneClusterId> retrieve(
StandaloneClusterId standaloneClusterId) throws ClusterRetrieveException {
return () -> {
try {
return new RestClusterClient<>(config, standaloneClusterId);
} catch (Exception e) {
throw new RuntimeException("Couldn't retrieve standalone cluster", e);
}
};
}
@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 doView on GitHub (pinned to 2f3c205e92)
Solutions
- Start the standalone cluster manually: run start-cluster.sh in FLINK_HOME/bin/, then use retrieve() instead of deploySessionCluster()
- Switch to a managed deployment backend (YARN or Kubernetes) if you need Flink to manage cluster lifecycle
- If using the programmatic API, branch on the descriptor type and only call deploySessionCluster for YarnClusterDescriptor or KubernetesClusterDescriptor
Example fix
// before standaloneDescriptor.deploySessionCluster(clusterSpec); // after // start cluster externally, then retrieve start-cluster.sh // external standaloneDescriptor.retrieve(StandaloneClusterId.getInstance());
Defensive patterns
Strategy: type-guard
Type guard
// Guard against calling deploySessionCluster on a standalone descriptor:
if (descriptor instanceof StandaloneClusterDescriptor) {
throw new UnsupportedOperationException(
"Cannot deploy a session cluster for standalone. Use start-cluster.sh externally.");
} Try / catch
try {
descriptor.deploySessionCluster(clusterSpec);
} catch (UnsupportedOperationException e) {
LOG.warn("This deployment type does not support session deployment: {}", e.getMessage());
} Prevention
- Branch deployment logic on the descriptor type before calling deploy methods
- Use managed deployments (YARN/K8s) if programmatic cluster lifecycle is required
- Document which deployment backends support which lifecycle operations
When it happens
Trigger: Programmatically calling deploySessionCluster on a StandaloneClusterDescriptor instance; using the deployment API with execution.target=remote or execution.target=standalone expecting Flink to start the cluster for you.
Common situations: Migrating from a managed deployment (YARN/K8s) to standalone and forgetting that the cluster lifecycle must be managed externally; generic deployment code that calls deploySessionCluster on any descriptor type.
Related errors
- Application Mode not supported by standalone deployments.
- Cannot terminate a standalone cluster.
- Couldn't retrieve standalone cluster
- No cluster id was specified. Please specify a cluster to whi
- No valid command-line found.
AI-assisted analysis of apache/flink@2f3c205e92 (2026-08-14).
Data as JSON: /api/errors/1a0ab2a90017fc2f.
Report an issue: GitHub.