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
- Supply a non-empty pool name; reject blank input before calling the API.
- If the name comes from config, fail fast on missing values rather than passing null.
- 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
- Derive pool names only from validated, non-blank sources.
- Fail fast on missing config keys instead of defaulting to null names.
- Add integration tests for pool CRUD with blank-name inputs.
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
- Limit is negative.
- Default Replication is negative
- Max relative expiry is negative.
- Max relative expiry is too big.
- Path part {s} from URI {p} is not a valid filename.
AI-assisted analysis of apache/hadoop@2add963021 (2026-08-22).
Data as JSON: /api/errors/98f1d09041bec83e.
Report an issue: GitHub.