{"record":{"id":"44888b5b9d94807d","repo":"apache/hadoop","slug":"unable-to-create-dbfile","errorCode":null,"errorMessage":"Unable to create \" + dbFile","messagePattern":"Unable to create \" \\+ dbFile","errorType":"exception","errorClass":"IOException","httpStatus":null,"severity":"error","filePath":"hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/common/blockaliasmap/impl/LevelDBFileRegionAliasMap.java","lineNumber":118,"sourceCode":"  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);\n  }\n\n  @Override\n  public void refresh() throws IOException {\n  }\n\n  @Override\n  public void close() throws IOException {\n    // Do nothing.\n  }\n\n  /**\n   * Class specifying reader options for the {@link LevelDBFileRegionAliasMap}.\n   */\n  public static class LevelDBOptions implements LevelDBReader.Options,","sourceCodeStart":100,"sourceCodeEnd":136,"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#L100-L136","documentation":"For writers, createDB first ensures the target directory (levelDBPath, optionally with blockPoolID appended) exists; if File.mkdirs() returns false — permission denied, a regular file occupying the path, read-only filesystem, or missing ancestors — this IOException names the directory it could not create.","triggerScenarios":"The leveldb path's parent is not writable by the process, the path exists as a regular file, the volume is read-only or full, or another process concurrently manipulates the directory.","commonSituations":"DN running as a user without write access to dfs.provided.aliasmap.leveldb.path; a stale file left where the directory should be; volume mounted read-only after an fs error.","solutions":["Check permissions along the whole path and chown/chmod the alias map root for the running user","Ensure no regular file occupies the directory path; remove or relocate it","Verify the filesystem is mounted read-write and has free space (df -h)"],"exampleFix":"# before\nls -l /hdfs/provided/aliasmap   # regular file or unwritable dir\n\n# after\nrm -f /hdfs/provided/aliasmap\nmkdir -p /hdfs/provided/aliasmap && chown hdfs:hdfs /hdfs/provided/aliasmap","handlingStrategy":"validation","validationCode":"Path dbDir = blockPoolID != null\n    ? Paths.get(levelDBPath, blockPoolID) : Paths.get(levelDBPath);\nif (Files.exists(dbDir) && !Files.isDirectory(dbDir)) {\n  throw new IllegalStateException(\"Path occupied by a file: \" + dbDir);\n}\nFiles.createDirectories(dbDir); // throws with a clear cause if not permitted\nif (!Files.isWritable(dbDir)) {\n  throw new IllegalStateException(\"Alias map dir not writable: \" + dbDir);\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Pre-create and chown the alias map directory during cluster provisioning","Include the alias map path in filesystem monitoring (writability + free space)"],"tags":["provided-storage","aliasmap","leveldb","permissions","mkdir-failed"],"backgroundTag":"cannot-create-directory","analyzedSha":"2add9630210752f88ceb1bb74eb65e37bf41da8e","analyzedAt":"2026-08-22T19:55:07.957Z","schemaVersion":2},"datasetVersion":"2026-08-23T01:17:44.959Z"}