pentaho/pentaho-kettle · error · KettleFileException

<toString()> : Unable to read value metadata from input…

Error message

<toString()> : Unable to read value metadata from input stream

What it means

Thrown when an IOException (other than EOF) occurs reading the type int from the DataInputStream in the deprecated ValueMetaBase(DataInputStream) constructor. It wraps the underlying IO problem and prefixes the value metadata name, indicating the value metadata could not be read from the stream.

Solutions

  1. Verify the source file/stream is complete and not truncated (compare size/checksum)
  2. Ensure the writer finished and flushed/closed the stream before reading
  3. Check filesystem/network health; retry the read on a fresh stream
  4. Stop using the deprecated constructor; use the current metadata serialization API

Example fix

// before
ValueMetaBase vm = new ValueMetaBase(dis); // KettleFileException on broken stream
// after
if (file.length() == 0 || !file.canRead()) {
  throw new KettleFileException("Input file missing or empty: " + file);
}
ValueMetaBase vm = new ValueMetaBase(new DataInputStream(new BufferedInputStream(new FileInputStream(file))));
Defensive patterns

Strategy: try-catch

Validate before calling

File f = new File(path);
if (!f.isFile() || !f.canRead() || f.length() == 0) {
  throw new KettleFileException("Cannot read metadata file: " + path);
}

Try / catch

try {
  ValueMetaBase vm = new ValueMetaBase(dis);
} catch (KettleFileException e) {
  Throwable cause = e.getCause(); // IOException details
  log.error("Stream broken reading value metadata: " + cause, cause);
  throw e;
}

Prevention

When it happens

Trigger: new ValueMetaBase(dataInputStream) while the underlying stream is closed, broken, or the source file/pipe disappears mid-read — any IOException thrown by readInt() that is not EOFException.

Common situations: Reading a binary file truncated by an earlier failed write; socket/file stream closed by another thread; disk or network failure while streaming Kettle binary metadata.

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/50708b8235a8e11b. Report an issue: GitHub.

Appendix: source

Thrown at core/src/main/java/org/pentaho/di/core/row/value/ValueMetaBase.java:361

  }

  /**
   * Create a new Value meta object.
   *
   * @param inputStream
   * @throws KettleFileException
   * @throws KettleEOFException
   * @deprecated in favor of a combination of {@link ValueMetaFactory}.createValueMeta() and the loadMetaData() method.
   */
  @Deprecated
  public ValueMetaBase( DataInputStream inputStream ) throws KettleFileException, KettleEOFException {
    this();
    try {
      type = inputStream.readInt();
    } catch ( EOFException e ) {
      throw new KettleEOFException( e );
    } catch ( IOException e ) {
      throw new KettleFileException( toString() + " : Unable to read value metadata from input stream", e );
    }

    readMetaData( inputStream );
  }

  /**
   * @deprecated use {@link #ValueMetaBase(String, int)} and {@link #setStorageType(int)} instead
   *
   * @param name
   * @param type
   * @param storageType
   */
  @Deprecated
  public ValueMetaBase( String name, int type, int storageType ) {
    this( name, type, -1, -1 );
    this.storageType = storageType;
    setDefaultConversionMask();
  }

View on GitHub (pinned to f3058517a1)