pentaho/pentaho-kettle · warning · KettleException
Could not close line number file
Error message
Could not close line number file
What it means
After reading, initialize() tries to close the reader in a finally block; an IOException from close() is wrapped in this KettleException. This is a cleanup failure, typically indicating an underlying stream/filesystem problem.
Solutions
- Check the wrapped IOException cause; often secondary to the primary read error
- Verify the file is on a healthy, writable/readable filesystem
- Retry the operation after fixing the read error
- Consider closing via try-with-resources to surface the original exception
Example fix
// before
// manual finally-close wraps close() IOException
// after
try (BufferedReader reader = ...) { /* read */ } // close errors handled by resource mgmt Defensive patterns
Strategy: try-catch
Try / catch
try {
playList = new FilePlayListReplayLineNumberFile(file, lineNumberFile, charset);
} catch (KettleException e) {
if (e.getMessage().startsWith("Could not close line number file")) {
log.warn("Non-fatal close failure on line-number file", e.getCause());
} else throw e;
} Prevention
- Treat close failures as symptoms of an earlier I/O problem and fix the root cause
- Run on healthy local filesystems rather than flaky network mounts for replay files
- Keep the KettleVFS cache clean to avoid stale handles
When it happens
Trigger: reader.close() throws IOException while releasing the line-number file handle, e.g. underlying VFS stream already broken or OS-level I/O error.
Common situations: VFS file handle already invalidated; disk/permission issue during close; reading exception earlier left the stream in a bad state.
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
- Unable to close output of file
- AbstractFileErrorHandler.Exception.CouldNotCreateFileErrorHandlerForFile
- AbstractFileErrorHandler.Exception.CouldNotCloseFile
- AvroInputDialog.Error.KettleFileException
- context.getMessage()
AI-assisted analysis of pentaho/pentaho-kettle@f3058517a1 (2026-09-13).
Data as JSON: /api/errors/d4cb04651b053073.
Report an issue: GitHub.
Appendix: source
Thrown at engine/src/main/java/org/pentaho/di/core/playlist/FilePlayListReplayLineNumberFile.java:58
reader = new BufferedReader( new InputStreamReader( KettleVFS.getInputStream( lineNumberFile ) ) );
} else {
reader =
new BufferedReader( new InputStreamReader( KettleVFS.getInputStream( lineNumberFile ), encoding ) );
}
String line = null;
while ( ( line = reader.readLine() ) != null ) {
if ( line.length() > 0 ) {
lineNumbers.add( Long.valueOf( line ) );
}
}
} catch ( Exception e ) {
throw new KettleException( "Could not read line number file " + lineNumberFile.getName().getURI(), e );
} finally {
if ( reader != null ) {
try {
reader.close();
} catch ( IOException e ) {
throw new KettleException( "Could not close line number file " + lineNumberFile.getName().getURI(), e );
}
}
}
}
public boolean isProcessingNeeded( FileObject file, long lineNr, String filePart ) throws KettleException {
return lineNumbers.contains( new Long( lineNr ) );
}
}
View on GitHub (pinned to f3058517a1)