{"record":{"id":"d7faedd125b88d14","repo":"prestodb/presto","slug":"no-nodes-available-d7faed","errorCode":"NO_NODES_AVAILABLE","errorMessage":"No nodes available to run query","messagePattern":"No nodes available to run query","errorType":"error_code","errorClass":"PrestoException","httpStatus":null,"severity":"critical","filePath":"presto-spi/src/main/java/com/facebook/presto/spi/NodeManager.java","lineNumber":36,"sourceCode":"import static com.facebook.presto.spi.StandardErrorCode.NO_NODES_AVAILABLE;\n\npublic interface NodeManager\n{\n    Set<Node> getAllNodes();\n\n    Set<Node> getWorkerNodes();\n\n    Node getCurrentNode();\n\n    Node getSidecarNode();\n\n    String getEnvironment();\n\n    default Set<Node> getRequiredWorkerNodes()\n    {\n        Set<Node> nodes = getWorkerNodes();\n        if (nodes.isEmpty()) {\n            throw new PrestoException(NO_NODES_AVAILABLE, \"No nodes available to run query\");\n        }\n        return nodes;\n    }\n}\n","sourceCodeStart":18,"sourceCodeEnd":41,"githubUrl":"https://github.com/prestodb/presto/blob/55bb57d202de3b926896fa966c2c4a44c779634e/presto-spi/src/main/java/com/facebook/presto/spi/NodeManager.java#L18-L41","documentation":"NodeManager.getRequiredWorkerNodes() fetches the set of active worker nodes and throws PrestoException with code NO_NODES_AVAILABLE if none exist. The coordinator cannot schedule any query work without workers, so it fails the operation immediately with this explicit message rather than producing an unrunnable plan.","triggerScenarios":"Calling getRequiredWorkerNodes() (directly or via query scheduling) while getWorkerNodes() returns an empty set — all workers shut down, failed heartbeats, node URI/environment mismatch filtering them out.","commonSituations":"Workers not started or crashed at coordinator startup; discovery URI misconfigured so workers register elsewhere; network/firewall blocking heartbeat ports; internalCommunication environment names differing between coordinator and workers; all workers retired during rolling restart with min worker count unmet.","solutions":["Verify worker processes are running and registered (coordinator UI /age/most recent heartbeats)","Check discovery.uri on workers points at the coordinator and both sides share the same node.environment","Check network connectivity/ports between workers and coordinator (discovery port, HTTP port)","Inspect coordinator logs for worker shutdown/heartbeat-expiry reasons and restart workers","For rolling restarts, keep sufficient workers up or pause query submission"],"exampleFix":"# before (worker etc/node.properties)\nnode.environment=production\ndiscovery.uri=http://wrong-host:8080\n# after\nnode.environment=production\ndiscovery.uri=http://coordinator:8080","handlingStrategy":"retry","validationCode":"Set<Node> workers = nodeManager.getWorkerNodes();\nif (workers.isEmpty()) {\n    throw new PrestoException(NO_NODES_AVAILABLE, \"No workers registered; check worker discovery.uri and node.environment\");\n}","typeGuard":null,"tryCatchPattern":"try {\n    nodes = nodeManager.getRequiredWorkerNodes();\n} catch (PrestoException e) {\n    if (e.getErrorCode().getCode() == NO_NODES_AVAILABLE.getCode()) {\n        // wait/backoff for workers to register, then retry\n        scheduleRetryWithBackoff();\n    } else {\n        throw e;\n    }\n}","preventionTips":["Monitor active worker count and alert before it hits zero","Verify node.environment and discovery.uri match across coordinator and workers","Use failure detection thresholds so one flapped heartbeat doesn't empty the pool","Configure enough workers/rolling restarts to keep capacity available"],"tags":["spi","cluster","scheduling","no-workers","presto-exception"],"backgroundTag":"no-nodes-available","analyzedSha":"55bb57d202de3b926896fa966c2c4a44c779634e","analyzedAt":"2026-09-04T12:50:26.162Z","contentChangedAt":"2026-09-04T12:50:26.162Z","schemaVersion":2},"datasetVersion":"2026-09-11T21:17:09.523Z"}