pentaho/pentaho-kettle · error · KettleFileException
Unable to read cache entry from data input stream
Error message
Unable to read cache entry from data input stream
What it means
Thrown by the DBCacheEntry(DataInputStream) constructor when any non-EOF error occurs while reading the dbname/sql UTF strings — e.g. corrupted UTF data, wrong stream format, or an underlying IOException. It signals the stream does not contain a valid cache entry.
Solutions
- Confirm the input stream reads from a valid DBCache file produced by DBCacheEntry.write, not another file type
- Delete the corrupt cache file and let it regenerate
- Ensure no other code has consumed bytes from the stream before the constructor runs (offset misalignment)
- Catch KettleFileException around the call and skip/rebuild the cache entry
Example fix
// before
DBCacheEntry entry = new DBCacheEntry(dis);
// after
try {
DBCacheEntry entry = new DBCacheEntry(dis);
} catch (KettleFileException e) {
log.warn("Invalid cache entry skipped, rebuilding", e);
entry = null;
} Defensive patterns
Strategy: try-catch
Validate before calling
File cacheFile = new File("db.cache");
if (cacheFile.length() == 0) {
cacheFile.delete();
return; // nothing to read
} Try / catch
try {
DBCacheEntry entry = new DBCacheEntry(dis);
} catch (KettleFileException e) {
log.warn("Skipping unreadable cache entry", e);
} Prevention
- Only feed streams produced by DBCacheEntry.write into the constructor
- Keep stream position at the entry start; don't share the stream across unrelated reads
- Delete cache files when upgrading PDI versions
When it happens
Trigger: Calling new DBCacheEntry(dis) on a stream whose bytes are not a DBCacheEntry serialization: wrong file type passed in, stream offset misaligned, or DataInputStream.readUTF() hitting malformed modified-UTF-8 bytes.
Common situations: Pointing the deserializer at a random/config file instead of the db.cache file, reading a cache file created by an incompatible PDI version, mixing byte streams with reader streams so offsets shift.
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
- End of file reached
- Couldn't write to the database cache
- Error serializing rows of data to the COPY command
- Error writing marker flag
- ResourceUtil.Exception.ErrorSerializingExportInterface
AI-assisted analysis of pentaho/pentaho-kettle@f3058517a1 (2026-09-13).
Data as JSON: /api/errors/19e4464a034d4946.
Report an issue: GitHub.
Appendix: source
Thrown at core/src/main/java/org/pentaho/di/core/DBCacheEntry.java:100
}
/**
* 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;
} catch ( Exception e ) {
return false;View on GitHub (pinned to f3058517a1)