pentaho/pentaho-kettle · error · KettleEOFException

End of file reached

Error message

End of file reached

What it means

Thrown by the DBCacheEntry(DataInputStream) constructor when the stream ends before the database name and SQL strings have been fully read. The library wraps the low-level EOFException in a KettleEOFException to signal that the cached database-query entry is truncated.

Solutions

  1. Delete the corrupt DBCache file (typically $KETTLE_HOME/.kettle/db.cache) and let Pentaho rebuild it
  2. Verify the cache file was fully written/transferred (compare sizes or checksums against a healthy install)
  3. Check that the stream being passed actually points at the start of a DBCacheEntry and was produced by DBCacheEntry.write
  4. Wrap the constructor call so KettleEOFException clears/rebuilds the cache instead of aborting

Example fix

// before
DBCacheEntry entry = new DBCacheEntry(dis);
// after
DBCacheEntry entry;
try {
  entry = new DBCacheEntry(dis);
} catch (KettleEOFException e) {
  cache.clear(); // truncated/corrupt cache file
  entry = null;
}
Defensive patterns

Strategy: try-catch

Validate before calling

// verify cache file exists and is plausibly sized before reading
File cacheFile = new File(System.getProperty("user.home"), ".kettle/db.cache");
if (!cacheFile.exists() || cacheFile.length() < 8) {
  cacheFile.delete(); // force rebuild
}

Try / catch

try {
  DBCacheEntry entry = new DBCacheEntry(dis);
} catch (KettleEOFException e) {
  // treat cache as corrupt: clear cache and continue without cache
}

Prevention

When it happens

Trigger: Calling new DBCacheEntry(dis) on a DataInputStream whose content is shorter than two UTF strings — e.g. the underlying DBCache file was truncated by a crash, partial copy, or disk-full while the cache file was being written.

Common situations: A corrupted or half-written kettle.properties-adjacent DBCache file after a JVM kill, a manually truncated cache file, deserializing a stream positioned at the wrong offset, or reading a cache file from a different PDI version.

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

Appendix: source

Thrown at core/src/main/java/org/pentaho/di/core/DBCacheEntry.java:98

    }
    return false;
  }

  /**
   * Read the data for this Cache entry from a data input stream
   *
   * @param dis
   *          The DataInputStream to read this entry from.
   * @throws KettleFileException
   *           if the cache can't be read from disk when it should be able to. If the cache file doesn't exists, no
   *           exception is thrown
   */
  public DBCacheEntry( DataInputStream dis ) throws KettleFileException {
    try {
      dbname = dis.readUTF();
      sql = dis.readUTF();
    } catch ( EOFException eof ) {
      throw new KettleEOFException( "End of file reached", eof );
    } catch ( Exception e ) {
      throw new KettleFileException( "Unable to read cache entry from data input stream", e );
    }
  }

  /**
   * Write the data for this Cache entry to a data output stream
   *
   * @param dos
   *          The DataOutputStream to write this entry to.
   * @return True if all went well, false if an error occured!
   */
  public boolean write( DataOutputStream dos ) {
    try {
      dos.writeUTF( dbname );
      dos.writeUTF( sql );

      return true;

View on GitHub (pinned to f3058517a1)