{"record":{"id":"7fb7c457d9f6991b","repo":"apache/hadoop","slug":"unrecognized-file-format","errorCode":null,"errorMessage":"Unrecognized file format","messagePattern":"Unrecognized file format","errorType":"exception","errorClass":"IOException","httpStatus":null,"severity":"error","filePath":"hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSImageFormatProtobuf.java","lineNumber":361,"sourceCode":"      int threads = conf.getInt(DFSConfigKeys.DFS_IMAGE_PARALLEL_THREADS_KEY,\n          DFSConfigKeys.DFS_IMAGE_PARALLEL_THREADS_DEFAULT);\n      if (threads < 1) {\n        LOG.warn(\"Parallel is enabled and {} is set to {}. Setting to the \" +\n            \"default value {}\", DFSConfigKeys.DFS_IMAGE_PARALLEL_THREADS_KEY,\n            threads, DFSConfigKeys.DFS_IMAGE_PARALLEL_THREADS_DEFAULT);\n        threads = DFSConfigKeys.DFS_IMAGE_PARALLEL_THREADS_DEFAULT;\n      }\n      ExecutorService executorService = Executors.newFixedThreadPool(\n          threads);\n      LOG.info(\"The fsimage will be loaded in parallel using {} threads\",\n          threads);\n      return executorService;\n    }\n\n    private void loadInternal(RandomAccessFile raFile, FileInputStream fin)\n        throws IOException {\n      if (!FSImageUtil.checkFileFormat(raFile)) {\n        throw new IOException(\"Unrecognized file format\");\n      }\n      FileSummary summary = FSImageUtil.loadSummary(raFile);\n      if (requireSameLayoutVersion && summary.getLayoutVersion() !=\n          HdfsServerConstants.NAMENODE_LAYOUT_VERSION) {\n        throw new IOException(\"Image version \" + summary.getLayoutVersion() +\n            \" is not equal to the software version \" +\n            HdfsServerConstants.NAMENODE_LAYOUT_VERSION);\n      }\n\n      FileChannel channel = fin.getChannel();\n\n      FSImageFormatPBINode.Loader inodeLoader = new FSImageFormatPBINode.Loader(\n          fsn, this);\n      FSImageFormatPBSnapshot.Loader snapshotLoader = new FSImageFormatPBSnapshot.Loader(\n          fsn, this);\n\n      ArrayList<FileSummary.Section> sections = Lists.newArrayList(summary\n          .getSectionsList());","sourceCodeStart":343,"sourceCodeEnd":379,"githubUrl":"https://github.com/apache/hadoop/blob/2add9630210752f88ceb1bb74eb65e37bf41da8e/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSImageFormatProtobuf.java#L343-L379","documentation":"Error \"Unrecognized file format\" thrown in apache/hadoop.","triggerScenarios":"Reading an fsimage file whose magic header does not match the expected protobuf fsimage format.","commonSituations":"See trigger scenarios.","solutions":["Ensure the file is a valid protobuf-format fsimage produced by this HDFS version.","Point dfs.namenode.name.dir at the correct storage directory."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"2add9630210752f88ceb1bb74eb65e37bf41da8e","analyzedAt":"2026-08-22T19:55:07.957Z","schemaVersion":2},"datasetVersion":"2026-08-22T20:17:22.307Z"}