{"record":{"id":"5f14bbf119e2678f","repo":"apache/hadoop","slug":"edits-file-is-not-found-in","errorCode":null,"errorMessage":"Edits file is not found in {}","messagePattern":"Edits file is not found in (.+?)","errorType":"exception","errorClass":"IOException","httpStatus":null,"severity":"critical","filePath":"hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSImagePreTransactionalStorageInspector.java","lineNumber":157,"sourceCode":"      } finally {\n        IOUtils.cleanupWithLogger(LOG, in);\n      }\n    }\n    return timeStamp;\n  }\n\n  @Override\n  boolean isUpgradeFinalized() {\n    return isUpgradeFinalized;\n  }\n    \n  @Override\n  List<FSImageFile> getLatestImages() throws IOException {\n    // We should have at least one image and one edits dirs\n    if (latestNameSD == null)\n      throw new IOException(\"Image file is not found in \" + imageDirs);\n    if (latestEditsSD == null)\n      throw new IOException(\"Edits file is not found in \" + editsDirs);\n    \n    // Make sure we are loading image and edits from same checkpoint\n    if (latestNameCheckpointTime > latestEditsCheckpointTime\n        && latestNameSD != latestEditsSD\n        && latestNameSD.getStorageDirType() == NameNodeDirType.IMAGE\n        && latestEditsSD.getStorageDirType() == NameNodeDirType.EDITS) {\n      // This is a rare failure when NN has image-only and edits-only\n      // storage directories, and fails right after saving images,\n      // in some of the storage directories, but before purging edits.\n      // See -NOTE- in saveNamespace().\n      LOG.error(\"This is a rare failure scenario!!!\");\n      LOG.error(\"Image checkpoint time \" + latestNameCheckpointTime +\n                \" > edits checkpoint time \" + latestEditsCheckpointTime);\n      LOG.error(\"Name-node will treat the image as the latest state of \" +\n                \"the namespace. Old edits will be discarded.\");\n    } else if (latestNameCheckpointTime != latestEditsCheckpointTime) {\n      throw new IOException(\"Inconsistent storage detected, \" +\n                      \"image and edits checkpoint times do not match. \" +","sourceCodeStart":139,"sourceCodeEnd":175,"githubUrl":"https://github.com/apache/hadoop/blob/2add9630210752f88ceb1bb74eb65e37bf41da8e/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSImagePreTransactionalStorageInspector.java#L139-L175","documentation":"Companion check in FSImagePreTransactionalStorageInspector.getLatestImages() for legacy pre-transactional layouts: after inspecting all configured edits directories, latestEditsSD is still null, i.e. no storage directory supplied an edits log. The inspector needs both an image and an edits file to compute the namespace state, so startup aborts.","triggerScenarios":"Booting a NameNode on pre-transactional-format storage where no dfs.namenode.edits.dir directory contains an edits file: IMAGE-only formatted dirs, edits file deleted, or edits dirs pointing at empty/wrong paths.","commonSituations":"Storage directories configured as IMAGE-only (NameNodeDirType.IMAGE) so no edits exist anywhere; edits removed during cleanup; wrong edits.dir after re-mounting storage.","solutions":["List the edits files present in each directory of dfs.namenode.edits.dir and confirm they are readable","Restore the edits file from backup or another storage directory copy","Fix dfs.namenode.edits.dir to point at the directories that actually hold the journal, then restart","If only an fsimage survives, recover the namespace from that image (accepting loss of post-checkpoint operations) or re-import a SecondaryNameNode checkpoint"],"exampleFix":"# before: no edits file anywhere under the edits dirs\nls /dfs/edits/current/   # only fstime, no edits\n# after: restore the journal that matches the image checkpoint\ncp /backup/edits /dfs/edits/current/","handlingStrategy":"validation","validationCode":"for (URI u : FSNamesystem.getEditsDirs(conf)) {\n  File f = new File(u.getPath(), \"current/edits\");\n  if (!f.exists()) {\n    LOG.error(\"no edits file in \" + f);\n  }\n}","typeGuard":null,"tryCatchPattern":"catch IOException from FSImage#loadFSImage; the exception prints the scanned editsDirs — verify each listed directory actually contains an edits file before retrying.","preventionTips":["Check every edits dir for an edits file before NN startup","Never configure all dirs as IMAGE-only storage","Back up the journal alongside every fsimage"],"tags":["hadoop","hdfs","namenode","edits","storage-dir","legacy-format"],"backgroundTag":"missing-checkpoint-file","analyzedSha":"2add9630210752f88ceb1bb74eb65e37bf41da8e","analyzedAt":"2026-08-22T19:55:07.957Z","schemaVersion":2},"datasetVersion":"2026-08-22T20:17:22.307Z"}