pentaho/pentaho-kettle · error · InvocationTargetException
TextFileCSVImportProgressDialog.Exception.ErrorScanningFile
TextFileCSVImportProgressDialog.Exception.ErrorScanningFile
Error message
TextFileCSVImportProgressDialog.Exception.ErrorScanningFile
What it means
TextFileCSVImportProgressDialog.run wraps any exception from doScan(monitor, failOnParseError) in an InvocationTargetException with the localized 'ErrorScanningFile' message, including the row number, debug state, and exception. It means the CSV sampling pass that infers delimiter/enclosure/field types failed.
Solutions
- Check the message's row number and debug context, then inspect that line of the file for malformed content.
- Verify the file exists, is readable, and is not locked by another process.
- Re-select the correct charset/encoding for the file and retry the scan.
- Increase the scan sample size or fix delimiter/enclosure settings manually, then rescan.
Example fix
// before: scanning with wrong encoding csvInputStream = new InputStreamReader( new FileInputStream( file ), "UTF-8" ); // after: use the file's actual encoding String charset = detectCharset( file ); // e.g. via ICU4J BufferedReader in = new BufferedReader( new InputStreamReader( new FileInputStream( file ), charset ) );
Defensive patterns
Strategy: try-catch
Validate before calling
File f = new File( filename );
if ( !f.isFile() || !f.canRead() ) {
throw new KettleException( "Cannot read file: " + filename );
} Try / catch
try {
message = doScan( monitor, failOnParseError );
} catch ( Exception e ) {
log.logError( "Error scanning file at row " + rownumber + " (" + debug + ")", e );
// inspect the failing row and encoding hints before retrying
} Prevention
- Confirm the file path, readability, and that it is not locked by other processes.
- Select the correct charset/encoding before scanning.
- Inspect the reported row number for malformed or over-long lines.
When it happens
Trigger: Opening the CSV import preview dialog on a file whose scan fails: unreadable/missing file, encoding that breaks the reader, malformed rows mid-file, or an incompatible character inside a quoted field at row `rownumber`.
Common situations: File path changed or file locked by another process; wrong charset selected so the parser hits invalid bytes; a very long or malformed line breaks the tokenizer; field count per row inconsistent with the inferred layout.
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
- TextFileCSVImportProgressDialog.Exception.ErrorScanningFile
- Can't encode object of class : className
- ChangeFileEncoding.Exception.TargetEncodingEmpty
- ConcatFields.Error.UnsupportedEncoding
- CsvInput.Exception.ErrorPreparingParallelRun
AI-assisted analysis of pentaho/pentaho-kettle@f3058517a1 (2026-09-13).
Data as JSON: /api/errors/fb21424e5f0c9341.
Report an issue: GitHub.
Appendix: source
Thrown at ui/src/main/java/org/pentaho/di/ui/trans/steps/fileinput/text/TextFileCSVImportProgressDialog.java:138
public String open() {
return open( true );
}
/**
* @param failOnParseError if set to true, parsing failure on any line will cause parsing to be terminated; when
* set to false, parsing failure on a given line will not prevent remaining lines from
* being parsed - this allows us to analyze fields, even if some field is mis-configured
* and causes a parsing error for the values of that field.
*/
@Override
public String open( final boolean failOnParseError ) {
IRunnableWithProgress op = new IRunnableWithProgress() {
public void run( IProgressMonitor monitor ) throws InvocationTargetException, InterruptedException {
try {
message = doScan( monitor, failOnParseError );
} catch ( Exception e ) {
e.printStackTrace();
throw new InvocationTargetException( e, BaseMessages.getString( PKG,
"TextFileCSVImportProgressDialog.Exception.ErrorScanningFile", "" + rownumber, debug, e.toString() ) );
}
}
};
try {
ProgressMonitorDialog pmd = new ProgressMonitorDialog( shell );
pmd.run( true, true, op );
} catch ( InvocationTargetException e ) {
new ErrorDialog( shell, BaseMessages.getString( PKG, "TextFileCSVImportProgressDialog.ErrorScanningFile.Title" ),
BaseMessages.getString( PKG, "TextFileCSVImportProgressDialog.ErrorScanningFile.Message" ), e );
} catch ( InterruptedException e ) {
new ErrorDialog( shell, BaseMessages.getString( PKG, "TextFileCSVImportProgressDialog.ErrorScanningFile.Title" ),
BaseMessages.getString( PKG, "TextFileCSVImportProgressDialog.ErrorScanningFile.Message" ), e );
}
return message;
}View on GitHub (pinned to f3058517a1)