apache/hadoop · error · IllegalArgumentException

A valid path needs to be specified for " + LevelDBFileRegion

Error message

A valid path needs to be specified for " + LevelDBFileRegionAliasMap.class + " using the parameter dfs.provided.aliasmap.leveldb.path

What it means

createDB needs a filesystem path for the LevelDB store, taken from LevelDBOptions which is populated from the dfs.provided.aliasmap.leveldb.path configuration key. A null or empty path throws IllegalArgumentException naming the exact key, because there is no sane default location for the alias map database.

Source

Thrown at hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/common/blockaliasmap/impl/LevelDBFileRegionAliasMap.java:103

  @Override
  public Writer<FileRegion> getWriter(Writer.Options opts, String blockPoolID)
      throws IOException {
    if (null == opts) {
      opts = this.opts;
    }
    if (!(opts instanceof LevelDBOptions)) {
      throw new IllegalArgumentException("Invalid options " + opts.getClass());
    }
    LevelDBOptions o = (LevelDBOptions) opts;
    return new LevelDBFileRegionAliasMap.LevelDBWriter(
        createDB(o.levelDBPath, true, blockPoolID));
  }

  private static DB createDB(String levelDBPath, boolean createIfMissing,
      String blockPoolID) throws IOException {
    if (levelDBPath == null || levelDBPath.length() == 0) {
      throw new IllegalArgumentException(
          "A valid path needs to be specified for "
              + LevelDBFileRegionAliasMap.class + " using the parameter "
              + DFS_PROVIDED_ALIASMAP_LEVELDB_PATH);
    }
    org.iq80.leveldb.Options options = new org.iq80.leveldb.Options();
    options.createIfMissing(createIfMissing);
    File dbFile;
    if (blockPoolID != null) {
      dbFile = new File(levelDBPath, blockPoolID);
    } else {
      dbFile = new File(levelDBPath);
    }
    if (createIfMissing && !dbFile.exists()) {
      if (!dbFile.mkdirs()) {
        throw new IOException("Unable to create " + dbFile);
      }
    }
    return factory.open(dbFile, options);

View on GitHub (pinned to 2add963021)

Solutions

  1. Set dfs.provided.aliasmap.leveldb.path in hdfs-site.xml, e.g. <property><name>dfs.provided.aliasmap.leveldb.path</name><value>/hdfs/provided/aliasmap</value></property>
  2. If configuring programmatically, call conf.set(DFSConfigKeys.DFS_PROVIDED_ALIASMAP_LEVELDB_PATH, path) before creating the alias map
  3. Confirm the config file is actually on the classpath of the process that opens the map

Example fix

# before: hdfs-site.xml has no leveldb aliasmap key
# after
<property>
  <name>dfs.provided.aliasmap.leveldb.path</name>
  <value>/hdfs/provided/aliasmap</value>
</property>
Defensive patterns

Strategy: validation

Validate before calling

String path = conf.get(DFSConfigKeys.DFS_PROVIDED_ALIASMAP_LEVELDB_PATH);
if (path == null || path.trim().isEmpty()) {
  throw new IllegalStateException(
      "dfs.provided.aliasmap.leveldb.path must be set for LevelDBFileRegionAliasMap");
}

Prevention

When it happens

Trigger: Instantiating/using LevelDBFileRegionAliasMap when dfs.provided.aliasmap.leveldb.path is unset or empty in hdfs-site.xml, or when a programmatic Configuration was built without setting the key.

Common situations: First-time provided-storage setup; unit/integration tests constructing a minimal Configuration; setting the key on the DN but not on the component that opens the alias map (or vice versa).

Related errors


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