pentaho/pentaho-kettle · error · KettleException
e (no own message; error opening CSV file)
Error message
e (no own message; error opening CSV file)
What it means
openNextFile wraps its work (VFS lookup, file opening, NIO channel setup, BOM detection) in a try/catch. KettleExceptions are rethrown unchanged, but any other Exception (IOException from FileObject resolution, file disappearance, permission errors, etc.) is wrapped in a new KettleException with no added message, so the original cause is preserved only as the cause chain.
Solutions
- Inspect the 'cause' of the KettleException in the stack trace to identify the underlying IOException or VFS error.
- Verify the file exists and is readable at the configured path before/while the transformation runs.
- Check VFS connection settings (credentials, host, scheme) if the filename is a remote URL.
- Re-run the transformation; if it is a transient race with file deletion, regenerate the file list just before reading.
Defensive patterns
Strategy: try-catch
Validate before calling
// pre-flight check before running the transformation
if (!java.nio.file.Files.isReadable(java.nio.file.Paths.get(filename))) {
throw new IllegalStateException("File missing or unreadable: " + filename);
} Try / catch
try { ... } catch (KettleException e) {
Throwable cause = e.getCause();
logError("Failed opening CSV file: " + (cause != null ? cause.toString() : e.getMessage()), e);
setErrors(1);
} Prevention
- Always read the cause chain — the wrapper carries no message
- Regenerate file lists immediately before reading to avoid races
- Verify VFS credentials/scheme for non-local URLs
- Ensure files are not deleted between listing and reading
When it happens
Trigger: Any non-Kettle exception during openNextFile: VFS cannot resolve the filename, the file was deleted between listing and opening, wrong credentials for a VFS provider, or an I/O error while opening the file channel.
Common situations: Race condition where a file listed by a previous step no longer exists; malformed file URL; OS-level permission problems; VFS provider misconfiguration (e.g. bad SFTP credentials).
Understand the failure class
Background: "open() failed", "failed to open file", "cannot create file" — what a file open error means and how to fix it — this error's family across 42 libraries.
Related errors
- CsvInput.Exception.CreateFieldMappingError
- Exception reading line using NIO
- throw new KettleException( e );
- Unable to close file channel for file '" + filenames[filenr…
- A deadlock was detected between steps
AI-assisted analysis of pentaho/pentaho-kettle@f3058517a1 (2026-09-13).
Data as JSON: /api/errors/5e2075f0f22f4292.
Report an issue: GitHub.
Appendix: source
Thrown at engine/src/main/java/org/pentaho/di/trans/steps/csvinput/CsvInput.java:418
logBasic( BaseMessages.getString( PKG, "CsvInput.Log.HeaderRowSkipped", data.filenames[ data.filenr - 1 ] ) );
if ( data.fieldsMapping.size() == 0 ) {
return false;
}
}
}
// Reset the row number pointer...
//
data.rowNumber = 1L;
// Don't skip again in the next file...
//
data.bytesToSkipInFirstFile = -1L;
return true;
} catch ( KettleException e ) {
throw e;
} catch ( Exception e ) {
throw new KettleException( e );
}
}
protected int getBOMSize( String vfsFilename ) throws Exception {
int bomSize = 0;
try ( FileInputStream fis = new FileInputStream( vfsFilename );
BufferedInputStream bis = new BufferedInputStream( fis ) ) {
BOMDetector bom = new BOMDetector( bis );
if ( bom.bomExist() ) {
bomSize = bom.getBomSize();
}
}
return bomSize;
}
FieldsMapping createFieldMapping( String fileName, CsvInputMeta csvInputMeta )View on GitHub (pinned to f3058517a1)