apache/hadoop · error · IOException

invalid empty cache pool name

Error message

invalid empty cache pool name

What it means

CachePoolInfo.validateName() throws IOException when the pool name is null or empty. Empty names are rejected because listing iterates pools in lexicographic order starting from prevKey "" — an empty name would be unlistable and confusing.

Source

Thrown at hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/protocol/CachePoolInfo.java:246

    if (info.getMaxRelativeExpiryMs() != null) {
      long maxRelativeExpiryMs = info.getMaxRelativeExpiryMs();
      if (maxRelativeExpiryMs < 0l) {
        throw new InvalidRequestException("Max relative expiry is negative.");
      }
      if (maxRelativeExpiryMs > Expiration.MAX_RELATIVE_EXPIRY_MS) {
        throw new InvalidRequestException("Max relative expiry is too big.");
      }
    }
    validateName(info.poolName);
  }

  public static void validateName(String poolName) throws IOException {
    if (poolName == null || poolName.isEmpty()) {
      // Empty pool names are not allowed because they would be highly
      // confusing.  They would also break the ability to list all pools
      // by starting with prevKey = ""
      throw new IOException("invalid empty cache pool name");
    }
  }
}

View on GitHub (pinned to 2add963021)

Solutions

  1. Supply a non-empty pool name; reject blank input before calling the API.
  2. If the name comes from config, fail fast on missing values rather than passing null.
  3. Use trim() + isEmpty() pre-checks in the caller.

Example fix

// before
dfs.addCachePool(new CachePoolInfo(poolName)); // poolName may be ""

// after
String name = poolName == null ? "" : poolName.trim();
Preconditions.checkArgument(!name.isEmpty(), "cache pool name must not be empty");
dfs.addCachePool(new CachePoolInfo(name));
Defensive patterns

Strategy: validation

Validate before calling

String name = poolName == null ? null : poolName.trim();
if (name == null || name.isEmpty()) {
  throw new IllegalArgumentException("cache pool name must be non-empty");
}
dfs.addCachePool(new CachePoolInfo(name));

Try / catch

try { dfs.addCachePool(new CachePoolInfo(name)); }
catch (IOException e) {
  if (e.getMessage().contains("invalid empty cache pool name")) { /* reject input early */ }
}

Prevention

When it happens

Trigger: addCachePool/modifyCachePool (or setPoolName) where the name is empty string or null: template-built names with a missing variable, whitespace-trimmed input, or default null from an unset config.

Common situations: Automation that derives pool names from directory names where the derivation returns ""; i18n input trimmed to empty; config key miss returning null.

Related errors


AI-assisted analysis of apache/hadoop@2add963021 (2026-08-22). Data as JSON: /api/errors/98f1d09041bec83e. Report an issue: GitHub.