apache/beam · warning · IOException

Unable to read data:

Error message

Unable to read data: 

What it means

HadoopInputFormatReader.advance wraps InterruptedException from the underlying Hadoop RecordReader: if the reading thread is interrupted while fetching the next key/value, it rethrows as IOException 'Unable to read data: '. It converts interruption during record iteration into the Beam reader's checked exception type.

Solutions

  1. Retry the pipeline run; interruption is usually external cancellation
  2. Check runner logs for the original interruption source (deadline, cancellation request)
  3. Ensure custom RecordReaders handle InterruptedException by restoring the interrupt flag rather than swallowing it
Defensive patterns

Strategy: retry

Try / catch

try {
  boolean has = reader.advance();
} catch (IOException e) {
  if (e.getCause() instanceof InterruptedException) {
    Thread.currentThread().interrupt();
    throw new CancellationException("Read interrupted; pipeline was canceled");
  }
  throw e;
}

Prevention

When it happens

Trigger: Thread interruption during nextKeyValue() in advance() — from runner cancellation, timeout-based preemption, or executor shutdown while draining records.

Common situations: Canceling streaming/batch jobs mid-read; Flink/Dataflow checkpoint cancel; VM preemption in managed runners.

Related errors


AI-assisted analysis of apache/beam@12126d8942 (2026-09-13). Data as JSON: /api/errors/854a1fb5180cea3a. Report an issue: GitHub.

Appendix: source

Thrown at sdks/java/io/hadoop-format/src/main/java/org/apache/beam/sdk/io/hadoop/format/HadoopFormatIO.java:960

              "Could not read because the thread got interrupted while "
                  + "reading the records with an exception: ",
              e);
        }
        doneReading = true;
        return false;
      }

      @Override
      public boolean advance() throws IOException {
        try {
          progressValue.set(getProgress());
          if (recordReader.nextKeyValue()) {
            recordsReturned.incrementAndGet();
            return true;
          }
          doneReading = true;
        } catch (InterruptedException e) {
          throw new IOException("Unable to read data: ", e);
        }
        return false;
      }

      @Override
      public KV<K, V> getCurrent() {
        K key;
        V value;
        try {
          // Transform key if translation function is provided.
          key =
              transformKeyOrValue(
                  recordReader.getCurrentKey(), keyTranslationFunction, keyCoder, skipKeyClone);
          // Transform value if translation function is provided.
          value =
              transformKeyOrValue(
                  recordReader.getCurrentValue(),
                  valueTranslationFunction,

View on GitHub (pinned to 12126d8942)