{"record":{"id":"c8ad657b7bde70f4","repo":"prestodb/presto","slug":"no-nodes-available","errorCode":"NO_NODES_AVAILABLE","errorMessage":"sortedCandidates is null or empty for ModularHashingNodeProvider","messagePattern":"sortedCandidates is null or empty for ModularHashingNodeProvider","errorType":"error_code","errorClass":"PrestoException","httpStatus":null,"severity":"error","filePath":"presto-main-base/src/main/java/com/facebook/presto/execution/scheduler/ModularHashingNodeProvider.java","lineNumber":39,"sourceCode":"import java.util.ArrayList;\nimport java.util.List;\n\nimport static com.facebook.presto.spi.StandardErrorCode.NO_NODES_AVAILABLE;\nimport static com.google.common.hash.Hashing.murmur3_32;\nimport static java.lang.Math.toIntExact;\nimport static java.nio.charset.StandardCharsets.UTF_8;\nimport static java.util.Collections.unmodifiableList;\n\npublic class ModularHashingNodeProvider\n{\n    private static final HashFunction HASH_FUNCTION = murmur3_32();\n\n    private final List<InternalNode> sortedCandidates;\n\n    public ModularHashingNodeProvider(List<InternalNode> sortedCandidates)\n    {\n        if (sortedCandidates == null || sortedCandidates.isEmpty()) {\n            throw new PrestoException(NO_NODES_AVAILABLE, \"sortedCandidates is null or empty for ModularHashingNodeProvider\");\n        }\n        this.sortedCandidates = sortedCandidates;\n    }\n\n    public List<HostAddress> get(String identifier, int count)\n    {\n        int size = sortedCandidates.size();\n        int position = toIntExact((HASH_FUNCTION.hashString(identifier, UTF_8).asInt() & 0xFFFFFFFFL) % size);\n        List<HostAddress> chosenCandidates = new ArrayList<>();\n        if (count > size) {\n            count = size;\n        }\n        for (int i = 0; i < count && i < sortedCandidates.size(); i++) {\n            chosenCandidates.add(sortedCandidates.get((position + i) % size).getHostAndPort());\n        }\n        return unmodifiableList(chosenCandidates);\n    }\n}","sourceCodeStart":21,"sourceCodeEnd":57,"githubUrl":"https://github.com/prestodb/presto/blob/55bb57d202de3b926896fa966c2c4a44c779634e/presto-main-base/src/main/java/com/facebook/presto/execution/scheduler/ModularHashingNodeProvider.java#L21-L57","documentation":"Constructor guard in ModularHashingNodeProvider: the candidate node list used for consistent modular hashing of bucketed data is null or empty, so no node can be selected. With no registered candidates the provider cannot be constructed, and this throws NO_NODES_AVAILABLE.","triggerScenarios":"Thrown at presto-main-base/src/main/java/com/facebook/presto/execution/scheduler/ModularHashingNodeProvider.java:39 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Ensure worker nodes are registered with discovery before queries needing this provider run","Check that the coordinator's node inventory for the catalog is non-empty","Investigate why the node list passed to the provider was empty (worker outage or discovery lag)"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"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"}