pentaho/pentaho-kettle · error · org.pentaho.di.core.exception.KettleEOFException

End of file while reading the number of metadata values in…

Error message

End of file while reading the number of metadata values in the row metadata

What it means

This constructor reads row metadata from an InputStream, starting with an int field count. An EOFException on that first readInt means the stream ended before any metadata could be read, so it is rethrown as KettleEOFException with an explicit message. SocketTimeoutException is deliberately rethrown unchanged so callers can retry socket reads.

Solutions

  1. Check the sending side: it likely wrote nothing or the write failed (look for paired writeMeta exceptions).
  2. Verify the stream/file is not empty and contains complete serialized metadata before reading.
  3. Re-transmit the metadata after re-establishing the connection.
  4. For files, compare file size against expected metadata length to detect truncation and regenerate the file.

Example fix

// before
RowMeta rowMeta = new RowMeta(inputStream); // throws KettleEOFException on empty stream
// after
if (inputStream.available() <= 0) {
  throw new KettleException("Peer sent no row metadata; requesting resend");
}
try {
  RowMeta rowMeta = new RowMeta(inputStream);
} catch (KettleEOFException e) {
  log.error("Truncated metadata stream", e);
  requestMetadataResend();
}
Defensive patterns

Strategy: validation

Validate before calling

if (inputStream == null || inputStream.available() <= 0) {
  throw new KettleException("No metadata bytes available on input stream");
}

Try / catch

try {
  RowMeta rowMeta = new RowMeta(inputStream);
} catch (KettleEOFException e) {
  log.error("Empty/truncated metadata stream", e);
  requestMetadataResend();
}

Prevention

When it happens

Trigger: Deserializing RowMeta from a stream that is already at EOF: empty file, zero-length socket message, peer closed the connection before sending metadata, or reading past the end of a truncated file.

Common situations: PDI slave server receiving an empty/truncated stream from master; reading a metadata cache file that was cut short by an earlier failed write; a network peer crashing mid-handshake.

Related errors


AI-assisted analysis of pentaho/pentaho-kettle@f3058517a1 (2026-09-13). Data as JSON: /api/errors/f8a441c6a56e0094. Report an issue: GitHub.

Appendix: source

Thrown at core/src/main/java/org/pentaho/di/core/row/RowMeta.java:727

      for ( int i = 0; i < size(); i++ ) {
        getValueMeta( i ).writeMeta( outputStream );
      }
    } finally {
      lock.readLock().unlock();
    }

  }

  public RowMeta( DataInputStream inputStream ) throws KettleFileException, SocketTimeoutException {
    this();

    int nr;
    try {
      nr = inputStream.readInt();
    } catch ( SocketTimeoutException e ) {
      throw e;
    } catch ( EOFException e ) {
      throw new KettleEOFException(
        "End of file while reading the number of metadata values in the row metadata", e );
    } catch ( IOException e ) {
      throw new KettleFileException( "Unable to read nr of metadata values: " + e.toString(), e );
    }

    for ( int i = 0; i < nr; i++ ) {
      try {
        int type = inputStream.readInt();
        ValueMetaInterface valueMeta = ValueMetaFactory.createValueMeta( type );
        valueMeta.readMetaData( inputStream );
        addValueMeta( valueMeta );
      } catch ( EOFException e ) {
        throw new KettleEOFException( e );
      } catch ( Exception e ) {
        throw new KettleFileException( toString() + " : Unable to read row metadata from input stream", e );
      }

    }

View on GitHub (pinned to f3058517a1)