{"record":{"id":"4e4dc623101e2e23","repo":"apache/hadoop","slug":"a-valid-path-needs-to-be-specified-for-leveldb","errorCode":null,"errorMessage":"A valid path needs to be specified for \" + LevelDBFileRegionAliasMap.class + \" using the parameter dfs.provided.aliasmap.leveldb.path","messagePattern":"A valid path needs to be specified for \" \\+ LevelDBFileRegionAliasMap\\.class \\+ \" using the parameter dfs\\.provided\\.aliasmap\\.leveldb\\.path","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/common/blockaliasmap/impl/LevelDBFileRegionAliasMap.java","lineNumber":103,"sourceCode":"\n  @Override\n  public Writer<FileRegion> getWriter(Writer.Options opts, String blockPoolID)\n      throws IOException {\n    if (null == opts) {\n      opts = this.opts;\n    }\n    if (!(opts instanceof LevelDBOptions)) {\n      throw new IllegalArgumentException(\"Invalid options \" + opts.getClass());\n    }\n    LevelDBOptions o = (LevelDBOptions) opts;\n    return new LevelDBFileRegionAliasMap.LevelDBWriter(\n        createDB(o.levelDBPath, true, blockPoolID));\n  }\n\n  private static DB createDB(String levelDBPath, boolean createIfMissing,\n      String blockPoolID) throws IOException {\n    if (levelDBPath == null || levelDBPath.length() == 0) {\n      throw new IllegalArgumentException(\n          \"A valid path needs to be specified for \"\n              + LevelDBFileRegionAliasMap.class + \" using the parameter \"\n              + DFS_PROVIDED_ALIASMAP_LEVELDB_PATH);\n    }\n    org.iq80.leveldb.Options options = new org.iq80.leveldb.Options();\n    options.createIfMissing(createIfMissing);\n    File dbFile;\n    if (blockPoolID != null) {\n      dbFile = new File(levelDBPath, blockPoolID);\n    } else {\n      dbFile = new File(levelDBPath);\n    }\n    if (createIfMissing && !dbFile.exists()) {\n      if (!dbFile.mkdirs()) {\n        throw new IOException(\"Unable to create \" + dbFile);\n      }\n    }\n    return factory.open(dbFile, options);","sourceCodeStart":85,"sourceCodeEnd":121,"githubUrl":"https://github.com/apache/hadoop/blob/2add9630210752f88ceb1bb74eb65e37bf41da8e/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/common/blockaliasmap/impl/LevelDBFileRegionAliasMap.java#L85-L121","documentation":"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.","triggerScenarios":"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.","commonSituations":"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).","solutions":["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>","If configuring programmatically, call conf.set(DFSConfigKeys.DFS_PROVIDED_ALIASMAP_LEVELDB_PATH, path) before creating the alias map","Confirm the config file is actually on the classpath of the process that opens the map"],"exampleFix":"# before: hdfs-site.xml has no leveldb aliasmap key\n# after\n<property>\n  <name>dfs.provided.aliasmap.leveldb.path</name>\n  <value>/hdfs/provided/aliasmap</value>\n</property>","handlingStrategy":"validation","validationCode":"String path = conf.get(DFSConfigKeys.DFS_PROVIDED_ALIASMAP_LEVELDB_PATH);\nif (path == null || path.trim().isEmpty()) {\n  throw new IllegalStateException(\n      \"dfs.provided.aliasmap.leveldb.path must be set for LevelDBFileRegionAliasMap\");\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Validate required provided-storage keys at process start, not lazily at first use","Keep a config lint step in deployment that checks alias map keys against dfs.provided.aliasmap.class"],"tags":["provided-storage","aliasmap","leveldb","configuration","missing-config"],"backgroundTag":"missing-configuration","analyzedSha":"2add9630210752f88ceb1bb74eb65e37bf41da8e","analyzedAt":"2026-08-22T19:55:07.957Z","schemaVersion":2},"datasetVersion":"2026-08-22T20:17:22.307Z"}