{"record":{"id":"174cba120e227dd6","repo":"prestodb/presto","slug":"no-nodes-available-174cba","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":"error","filePath":"presto-main-base/src/main/java/com/facebook/presto/execution/scheduler/nodeSelection/SimpleTtlNodeSelector.java","lineNumber":208,"sourceCode":"\n        OptionalInt preferredNodeCount = OptionalInt.empty();\n        for (Split split : splits) {\n            if (split.getNodeSelectionStrategy() != NodeSelectionStrategy.NO_PREFERENCE) {\n                throw new PrestoException(\n                        NODE_SELECTION_NOT_SUPPORTED,\n                        format(\"Unsupported node selection strategy for TTL scheduling: %s\", split.getNodeSelectionStrategy()));\n            }\n\n            List<InternalNode> candidateNodes = randomNodeSelection.pickNodes(split);\n            if (candidateNodes.isEmpty()) {\n                Duration remainingTime = getEstimatedExecutionTimeRemaining();\n                if (fallbackToSimpleNodeSelection) {\n                    log.warn(\"No nodes available with enough TTL (%s) to schedule %s. Active nodes %s, falling back to simple node selection.\", remainingTime, split, nodeMap.getActiveNodes());\n                    return simpleNodeSelector.computeAssignments(splits, existingTasks);\n                }\n\n                log.warn(\"No nodes available with enough TTL (%s) to schedule %s. Active nodes %s\", remainingTime, split, nodeMap.getActiveNodes());\n                throw new PrestoException(NO_NODES_AVAILABLE, \"No nodes available to run query\");\n            }\n\n            SplitWeight splitWeight = split.getSplitWeight();\n            Optional<InternalNodeInfo> chosenNodeInfo = simpleNodeSelector.chooseLeastBusyNode(\n                    splitWeight,\n                    candidateNodes,\n                    assignmentStats::getTotalSplitsWeight,\n                    preferredNodeCount,\n                    maxSplitsWeightPerNode,\n                    assignmentStats);\n            if (!chosenNodeInfo.isPresent()) {\n                chosenNodeInfo = simpleNodeSelector.chooseLeastBusyNode(\n                        splitWeight, candidateNodes, assignmentStats::getQueuedSplitsWeightForStage, preferredNodeCount, maxPendingSplitsWeightPerTask, assignmentStats);\n            }\n\n            if (chosenNodeInfo.isPresent()) {\n                split = new Split(\n                        split.getConnectorId(),","sourceCodeStart":190,"sourceCodeEnd":226,"githubUrl":"https://github.com/prestodb/presto/blob/55bb57d202de3b926896fa966c2c4a44c779634e/presto-main-base/src/main/java/com/facebook/presto/execution/scheduler/nodeSelection/SimpleTtlNodeSelector.java#L190-L226","documentation":"In SimpleTtlNodeSelector.computeAssignments, when no candidate node has enough remaining TTL (per nodeTtlFetcherManager and the query's estimated remaining execution time) to safely host the split, and fallbackToSimpleNodeSelection is disabled, the selector throws NO_NODES_AVAILABLE. The query's estimated execution time exceeds every active worker's TTL confidence window, so TTL-aware scheduling refuses to place the split. The same condition falls back to SimpleNodeSelector when the fallback flag is enabled.","triggerScenarios":"TTL scheduling enabled with node-scheduler.ttl-match-scheduler.fallback-to-simple-node-selection-when-serialization-time-not-available=false (fallback off); the query's estimated execution time remaining is longer than every active node's reported TTL from the TTL fetchers; all eligible nodes filtered out by TTL or exhausted via maxTasksPerStage.","commonSituations":"Long-running queries (high estimated time) on a cluster whose workers report short TTLs in the TTL file; missing or stale TTL entries for some nodes so their TTL info is empty; misestimated execution time making all nodes ineligible; TTL fetcher misconfiguration so no node matches.","solutions":["Enable the fallback: set node-scheduler.ttl-match-scheduler.fallback-to-simple-node-selection-when-serialization-time-not-available=true so scheduling falls back to SimpleNodeSelector instead of throwing.","Update the node TTL provider file/endpoint so workers report TTLs long enough for the workload, or shorten query resource estimates.","Check TTL fetcher configuration (ttl-match-scheduler providers / file paths) - missing TTL info means nodes are filtered out.","Reduce query size or split the workload so estimated execution time fits within node TTL windows.","Verify nodeTtlFetcherManager returns data (logs) and that nodes are actually active."],"exampleFix":"// before (etc/config.properties)\n// fallback disabled -> long queries throw NO_NODES_AVAILABLE\n\n// after\nnode-scheduler.ttl-match-scheduler.fallback-to-simple-node-selection-when-serialization-time-not-available=true","handlingStrategy":"fallback","validationCode":"// Ensure the TTL fallback is configured before using TTL scheduling\nif (useTtlScheduling && !fallbackToSimpleNodeSelection) {\n    throw new IllegalStateException(\"Enable node-scheduler.ttl-match-scheduler.fallback-to-simple-node-selection-when-serialization-time-not-available\");\n}","typeGuard":null,"tryCatchPattern":"try {\n    return ttlNodeSelector.computeAssignments(splits, existingTasks);\n} catch (PrestoException e) {\n    if (e.getErrorCode() == StandardErrorCode.NO_NODES_AVAILABLE.toErrorCode().getCode()) {\n        log.warn(\"No TTL-eligible nodes; falling back to simple node selection\");\n        return simpleNodeSelector.computeAssignments(splits, existingTasks);\n    }\n    throw e;\n}","preventionTips":["Always enable fallback-to-simple-node-selection when TTL scheduling is on.","Keep node TTL files/fetchers accurate and refresh them before they expire.","Cap query resource estimates so estimated execution time fits within node TTL windows.","Alert when a node's TTL info is missing or stale, since it will be filtered out of candidates."],"tags":["scheduler","ttl","no-workers","presto"],"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"}