{"record":{"id":"f41752350810a313","repo":"apache/hadoop","slug":"no-image-processor-to-read-version-is-available","errorCode":null,"errorMessage":"No image processor to read version {} is available.","messagePattern":"No image processor to read version (.+?) is available\\.","errorType":"exception","errorClass":"IOException","httpStatus":null,"severity":"error","filePath":"hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/tools/offlineImageViewer/OfflineImageViewer.java","lineNumber":137,"sourceCode":"  /**\n   * Process image file.\n   */\n  public void go() throws IOException  {\n    DataInputStream in = null;\n    PositionTrackingInputStream tracker = null;\n    ImageLoader fsip = null;\n    boolean done = false;\n    try {\n      tracker = new PositionTrackingInputStream(new BufferedInputStream(\n          Files.newInputStream(Paths.get(inputFile))));\n      in = new DataInputStream(tracker);\n\n      int imageVersionFile = findImageVersion(in);\n\n      fsip = ImageLoader.LoaderFactory.getLoader(imageVersionFile);\n\n      if(fsip == null) \n        throw new IOException(\"No image processor to read version \" +\n            imageVersionFile + \" is available.\");\n      fsip.loadImage(in, processor, skipBlocks);\n      done = true;\n    } finally {\n      if (!done) {\n        if (tracker != null) {\n          LOG.error(\"image loading failed at offset \" + tracker.getPos());\n        } else {\n          LOG.error(\"Failed to load image file.\");\n        }\n      }\n      IOUtils.cleanupWithLogger(LOG, in, tracker);\n    }\n  }\n\n  /**\n   * Check an fsimage datainputstream's version number.\n   *","sourceCodeStart":119,"sourceCodeEnd":155,"githubUrl":"https://github.com/apache/hadoop/blob/2add9630210752f88ceb1bb74eb65e37bf41da8e/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/tools/offlineImageViewer/OfflineImageViewer.java#L119-L155","documentation":"The legacy OfflineImageViewer (`hdfs oiv_legacy`, for pre-protobuf images) reads the layout version int at the head of the file and asks ImageLoader.LoaderFactory for a loader; no registered legacy loader accepted that version. Almost always this means the input is a protobuf fsimage from Hadoop 2.x+ (legacy loaders stop at the pre-PB layout versions), a corrupt file whose leading int is garbage, or not an fsimage at all.","triggerScenarios":"Running `hdfs oiv_legacy -i <file>` on: a protobuf fsimage from a 2.x+ NameNode, a truncated/corrupt file, an edit log, or the fsimage.md5 sidecar file.","commonSituations":"Old scripts still calling oiv_legacy after a cluster upgrade; a shell glob picking the wrong file from /dfs/name/current; version-mismatched tooling (tool older than the image).","solutions":["Use the protobuf-aware tool for 2.x+ images: `hdfs oiv -i <fsimage> -p delimited|XML|FileDistribution|Web`","Ensure the oiv binary comes from a Hadoop distribution at least as new as the NameNode that wrote the image","Confirm the input is really an fsimage: name matches fsimage_<txid> and (for PB images) `head -c 8 <file>` prints HDFSIMG1","For genuinely old images, verify the leading layout-version int falls in the range the legacy loaders support"],"exampleFix":"# before: legacy entry point on a protobuf image\nhdfs oiv_legacy -i fsimage_0000000000000123456 -o /tmp/out.xml\n# IOException: No image processor to read version -66 is available.\n\n# after: PB-aware entry point\nhdfs oiv -i fsimage_0000000000000123456 -p XML -o /tmp/out.xml","handlingStrategy":"validation","validationCode":"// Peek the layout version before handing the file to oiv_legacy\nint layoutVersion;\ntry (DataInputStream in = new DataInputStream(new BufferedInputStream(\n        Files.newInputStream(Paths.get(file))))) {\n  layoutVersion = in.readInt(); // legacy images start with the layout version int\n}\nif (ImageLoader.LoaderFactory.getLoader(layoutVersion) == null) {\n  throw new IllegalArgumentException(\n      \"layout version \" + layoutVersion\n      + \" not supported by oiv_legacy; use `hdfs oiv` for protobuf images\");\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Default to `hdfs oiv`; reserve oiv_legacy for genuinely pre-2.x images","Keep the oiv binary's Hadoop version at or above the image's producing NameNode","Pass explicit fsimage_<txid> paths instead of globbing the NameNode directory"],"tags":["hdfs","oiv-legacy","fsimage","version-mismatch"],"backgroundTag":"unsupported-file-version","analyzedSha":"2add9630210752f88ceb1bb74eb65e37bf41da8e","analyzedAt":"2026-08-22T19:55:07.957Z","schemaVersion":2},"datasetVersion":"2026-08-23T01:17:44.959Z"}