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

Unable to read nr of metadata values

Error message

Unable to read nr of metadata values: ${e.toString()}

What it means

While reading the field count in the RowMeta(InputStream) constructor, a generic IOException (not EOF, not socket timeout) is wrapped in KettleFileException with the message "Unable to read nr of metadata values: " plus the IOException's toString. This indicates an I/O problem other than a clean end-of-stream.

Solutions

  1. Parse the appended e.toString() to identify the exact I/O failure (connection reset, SSL handshake, disk error).
  2. For socket streams, re-establish the connection and retry the metadata read.
  3. For file streams, verify the file exists, is readable, and is not corrupted; regenerate it from the source.
  4. Distinguish SocketTimeoutException (rethrown upstream for retry) from other IOExceptions needing reconnect logic.

Example fix

// before
RowMeta rowMeta = new RowMeta(inputStream);
// after
try {
  RowMeta rowMeta = new RowMeta(inputStream);
} catch (KettleFileException e) {
  log.error("Metadata read I/O failure: " + e.getMessage(), e);
  inputStream = reconnect();
  RowMeta rowMeta = new RowMeta(inputStream);
}
Defensive patterns

Strategy: retry

Validate before calling

if (inputStream == null) { throw new IllegalStateException("Input stream is null"); }
if (inputStream instanceof SocketInputStream && !isConnected(socket)) { reconnect(); }

Try / catch

try {
  RowMeta rowMeta = new RowMeta(inputStream);
} catch (KettleFileException e) {
  log.error("I/O failure reading field count: " + e.getMessage(), e);
  inputStream = reconnect();
  RowMeta rowMeta = new RowMeta(inputStream);
}

Prevention

When it happens

Trigger: Calling new RowMeta(inputStream) when readInt throws a non-EOF IOException: connection reset, SSL error, underlying file I/O failure, or stream corruption on a socket.

Common situations: Network resets mid-metadata handshake between PDI cluster nodes; TLS/cipher mismatch causing read failures; filesystem errors reading a corrupt or inaccessible metadata file.

Understand the failure class

Background: "failed to read file", EACCES, ENOENT and "could not read <path>" errors: when a program can't read a file from disk — this error's family across 49 libraries.

Related errors


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

Appendix: source

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

    } 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 );
      }

    }
  }

  @Override

View on GitHub (pinned to f3058517a1)