{"record":{"id":"ea1d481e4f77db39","repo":"apache/flink","slug":"couldn-t-retrieve-standalone-cluster","errorCode":null,"errorMessage":"Couldn't retrieve standalone cluster","messagePattern":"Couldn't retrieve standalone cluster","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"flink-clients/src/main/java/org/apache/flink/client/deployment/StandaloneClusterDescriptor.java","lineNumber":52,"sourceCode":"    public StandaloneClusterDescriptor(Configuration config) {\n        this.config = Preconditions.checkNotNull(config);\n    }\n\n    @Override\n    public String getClusterDescription() {\n        String host = config.get(JobManagerOptions.ADDRESS, \"\");\n        int port = config.get(JobManagerOptions.PORT, -1);\n        return \"Standalone cluster at \" + host + \":\" + port;\n    }\n\n    @Override\n    public ClusterClientProvider<StandaloneClusterId> retrieve(\n            StandaloneClusterId standaloneClusterId) throws ClusterRetrieveException {\n        return () -> {\n            try {\n                return new RestClusterClient<>(config, standaloneClusterId);\n            } catch (Exception e) {\n                throw new RuntimeException(\"Couldn't retrieve standalone cluster\", e);\n            }\n        };\n    }\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","sourceCodeStart":34,"sourceCodeEnd":70,"githubUrl":"https://github.com/apache/flink/blob/2f3c205e9266cb30240eb7f4fdab15cad629a70f/flink-clients/src/main/java/org/apache/flink/client/deployment/StandaloneClusterDescriptor.java#L34-L70","documentation":"Thrown by StandaloneClusterDescriptor.retrieve when the RestClusterClient constructor throws an exception (e.g., cannot resolve the JobManager REST address, port not reachable, or invalid configuration). The StandaloneClusterId is always the same singleton (StandaloneClusterId.getInstance()), so the failure is purely about connectivity to the configured REST endpoint. The original exception is wrapped as the cause of a RuntimeException.","triggerScenarios":"Calling retrieve on a StandaloneClusterDescriptor when the JobManager REST endpoint at the configured address:port is unreachable; the REST port (rest.port, default 8081) is wrong or firewalled; the address resolves to a different host.","commonSituations":"Flink JobManager not started or crashed; REST port differs from the default; network policy or firewall blocks the REST port; DNS resolution failure for the configured jobmanager.rpc.address.","solutions":["Verify the JobManager is running and the REST endpoint is reachable: `curl http://<host>:8081/overview`","Check that rest.address and rest.port in flink-conf.yaml match the actual JobManager REST endpoint","Ensure no firewall or network policy blocks the REST port between the client and the JobManager"],"exampleFix":"// before (wrong address)\nconfig.set(JobManagerOptions.ADDRESS, \"wrong-host\");\nstandaloneDescriptor.retrieve(StandaloneClusterId.getInstance());\n\n// after\nconfig.set(JobManagerOptions.ADDRESS, \"correct-jm-host\");\nconfig.set(RestOptions.PORT, 8081);\nstandaloneDescriptor.retrieve(StandaloneClusterId.getInstance());","handlingStrategy":"try-catch","validationCode":"// Validate REST endpoint reachability before calling retrieve:\nString host = config.get(JobManagerOptions.ADDRESS);\nint port = config.get(RestOptions.PORT, 8081);\ntry (Socket s = new Socket()) {\n    s.connect(new InetSocketAddress(host, port), 5000);\n} catch (IOException e) {\n    throw new IllegalStateException(\n        \"JobManager REST endpoint not reachable at \" + host + \":\" + port, e);\n}","typeGuard":null,"tryCatchPattern":"try {\n    ClusterClientProvider<StandaloneClusterId> provider = descriptor.retrieve(id);\n} catch (RuntimeException e) {\n    if (e.getMessage().contains(\"Couldn't retrieve\")) {\n        Throwable cause = e.getCause();\n        LOG.error(\"Standalone cluster unreachable: {}\", cause.getMessage());\n    }\n    throw e;\n}","preventionTips":["Verify the JobManager REST endpoint is reachable before connecting: curl http://<host>:8081/overview","Ensure rest.address and rest.port in flink-conf.yaml match the actual endpoint","Check firewall rules between the client and the JobManager"],"tags":["deployment","standalone","rest","network","cluster-connection"],"backgroundTag":null,"analyzedSha":"2f3c205e9266cb30240eb7f4fdab15cad629a70f","analyzedAt":"2026-08-14T08:48:24.518Z","schemaVersion":2},"datasetVersion":"2026-08-14T10:17:34.591Z"}