apache/hadoop · error · IOException

Cannot run listCorruptFileBlocks because replication queues…

Error message

Cannot run listCorruptFileBlocks because replication queues have not been initialized.

What it means

Thrown by listCorruptFileBlocks when blockManager.isPopulatingReplQueues() is false — during NameNode startup/safe mode before replication queues are initialized, the corrupt-block report cannot be computed.

Solutions

  1. Start or restart the NameNode and wait until it has fully exited safemode and initialized replication queues before running listCorruptFileBlocks (hdfs fsck -list-corruptfileblocks).
Defensive patterns

Strategy: try-catch

When it happens

Trigger: An administrator or client invokes listCorruptFileBlocks/fsck while the NameNode is still starting up or in safemode.

Common situations: Running hdfs fsck immediately after a NameNode (re)start, before block manager initialization completes.


AI-assisted analysis of apache/hadoop@2add963021 (2026-08-22). Data as JSON: /api/errors/d1e82d537f0563d1. Report an issue: GitHub.

Appendix: source

Thrown at hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java:6331

        new ArrayList<CorruptFileBlockInfo>();
    if (cookieTab == null) {
      cookieTab = new String[] { null };
    }

    // Do a quick check if there are any corrupt files without taking the lock
    if (blockManager.getMissingBlocksCount() == 0) {
      if (cookieTab[0] == null) {
        cookieTab[0] = String.valueOf(getIntCookie(cookieTab[0]));
      }
      LOG.debug("there are no corrupt file blocks.");
      return corruptFiles;
    }

    readLock(RwLockMode.GLOBAL);
    try {
      checkOperation(OperationCategory.READ);
      if (!blockManager.isPopulatingReplQueues()) {
        throw new IOException("Cannot run listCorruptFileBlocks because " +
                              "replication queues have not been initialized.");
      }
      // print a limited # of corrupt files per call

      final Iterator<BlockInfo> blkIterator =
          blockManager.getCorruptReplicaBlockIterator();

      int skip = getIntCookie(cookieTab[0]);
      for (int i = 0; i < skip && blkIterator.hasNext(); i++) {
        blkIterator.next();
      }

      while (blkIterator.hasNext()) {
        BlockInfo blk = blkIterator.next();
        final INodeFile inode = getBlockCollection(blk);
        skip++;
        if (inode != null) {
          String src = inode.getFullPathName();

View on GitHub (pinned to 2add963021)