prestodb/presto · error · PrestoException

NO_NODES_AVAILABLE

NO_NODES_AVAILABLE

Error message

sortedCandidates is null or empty for ModularHashingNodeProvider

What it means

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.

Source

Thrown at presto-main-base/src/main/java/com/facebook/presto/execution/scheduler/ModularHashingNodeProvider.java:39

import java.util.ArrayList;
import java.util.List;

import static com.facebook.presto.spi.StandardErrorCode.NO_NODES_AVAILABLE;
import static com.google.common.hash.Hashing.murmur3_32;
import static java.lang.Math.toIntExact;
import static java.nio.charset.StandardCharsets.UTF_8;
import static java.util.Collections.unmodifiableList;

public class ModularHashingNodeProvider
{
    private static final HashFunction HASH_FUNCTION = murmur3_32();

    private final List<InternalNode> sortedCandidates;

    public ModularHashingNodeProvider(List<InternalNode> sortedCandidates)
    {
        if (sortedCandidates == null || sortedCandidates.isEmpty()) {
            throw new PrestoException(NO_NODES_AVAILABLE, "sortedCandidates is null or empty for ModularHashingNodeProvider");
        }
        this.sortedCandidates = sortedCandidates;
    }

    public List<HostAddress> get(String identifier, int count)
    {
        int size = sortedCandidates.size();
        int position = toIntExact((HASH_FUNCTION.hashString(identifier, UTF_8).asInt() & 0xFFFFFFFFL) % size);
        List<HostAddress> chosenCandidates = new ArrayList<>();
        if (count > size) {
            count = size;
        }
        for (int i = 0; i < count && i < sortedCandidates.size(); i++) {
            chosenCandidates.add(sortedCandidates.get((position + i) % size).getHostAndPort());
        }
        return unmodifiableList(chosenCandidates);
    }
}

View on GitHub (pinned to 55bb57d202)

Solutions

  1. Ensure worker nodes are registered with discovery before queries needing this provider run
  2. Check that the coordinator's node inventory for the catalog is non-empty
  3. Investigate why the node list passed to the provider was empty (worker outage or discovery lag)
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at presto-main-base/src/main/java/com/facebook/presto/execution/scheduler/ModularHashingNodeProvider.java:39 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of prestodb/presto@55bb57d202 (2026-09-04). Data as JSON: /api/errors/c8ad657b7bde70f4. Report an issue: GitHub.