prestodb/presto · error · IllegalArgumentException

id is empty

Error message

id is empty

What it means

MemoryPoolId's constructor validates its id string: it must be non-null and non-empty. An empty string throws IllegalArgumentException("id is empty"). MemoryPoolId names memory pools (e.g. 'general', 'reserved') in Presto's memory management, so it is usually constructed from configuration.

Solutions

  1. Set the memory pool name property to a non-empty value (e.g. general).
  2. Default the value in code: use a fallback when the config string is blank.
  3. Trim and validate the input string before constructing MemoryPoolId.

Example fix

// before
MemoryPoolId poolId = new MemoryPoolId(config.getPoolName()); // may be ""

// after
String name = config.getPoolName();
requireNonNull(name, "pool name is null");
checkArgument(!name.trim().isEmpty(), "pool name must not be empty");
MemoryPoolId poolId = new MemoryPoolId(name.trim());
Defensive patterns

Strategy: validation

Validate before calling

if (id == null || id.trim().isEmpty()) {
    throw new IllegalArgumentException("memory pool id must be a non-empty string");
}

Type guard

boolean isValidMemoryPoolId(String id) {
    return id != null && !id.isEmpty();
}

Try / catch

try {
    poolId = new MemoryPoolId(rawId);
} catch (IllegalArgumentException e) {
    poolId = new MemoryPoolId("general"); // safe default
}

Prevention

When it happens

Trigger: Calling new MemoryPoolId("") directly, or constructing a MemoryPool from a config property (e.g. memory pool name) that resolves to an empty string.

Common situations: Empty environment variable or properties file value for a pool name; test code building pools programmatically; config key present but value blank.

Related errors


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

Appendix: source

Thrown at presto-spi/src/main/java/com/facebook/presto/spi/memory/MemoryPoolId.java:37

import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonValue;

import java.util.Objects;

import static java.util.Objects.requireNonNull;

@ThriftStruct
public final class MemoryPoolId
{
    private final String id;

    @ThriftConstructor
    @JsonCreator
    public MemoryPoolId(String id)
    {
        requireNonNull(id, "id is null");
        if (id.isEmpty()) {
            throw new IllegalArgumentException("id is empty");
        }
        this.id = id;
    }

    @ThriftField(1)
    @JsonValue
    public String getId()
    {
        return id;
    }

    @Override
    public boolean equals(Object o)
    {
        if (this == o) {
            return true;
        }
        if (o == null || getClass() != o.getClass()) {

View on GitHub (pinned to 55bb57d202)