apache/hadoop · error · EOFException

Not enough bytes to read.

Error message

Not enough bytes to read.

What it means

Thrown by HarFsInputStream.readFully when start + length + pos exceeds end, i.e. the requested byte range extends past the fragment's end within the part file. Raised as EOFException since fewer bytes remain than requested.

Solutions

  1. Reduce the requested read length to the remaining bytes in the entry.
  2. Verify the Har index entry offsets/lengths match the part file contents; re-create the archive if corrupt.
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/HarFileSystem.java:1084 when the library encounters an invalid state.

Common situations: See trigger scenarios.


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

Appendix: source

Thrown at hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/HarFileSystem.java:1084

        if (nlength <= 0) {
          // EOS:
          return -1;
        }
        return underLyingStream.read(pos + start , b, offset, nlength);
      }
      
      /**
       * position readable again.
       */
      @Override
      public void readFully(long pos, byte[] b, int offset, int length) 
      throws IOException {
        validatePositionedReadArgs(pos, b, offset, length);
        if (length == 0) {
          return;
        }
        if (start + length + pos > end) {
          throw new EOFException("Not enough bytes to read.");
        }
        underLyingStream.readFully(pos + start, b, offset, length);
      }

      @Override
      public void setReadahead(Long readahead) throws IOException {
        underLyingStream.setReadahead(readahead);
      }

      @Override
      public void setDropBehind(Boolean dropBehind) throws IOException {
        underLyingStream.setDropBehind(dropBehind);
      }
    }
  
    /**
     * constructors for har input stream.
     * @param fs the underlying filesystem

View on GitHub (pinned to 2add963021)