pentaho/pentaho-kettle · error · InvocationTargetException

TextFileCSVImportProgressDialog.Exception.ErrorScanningFile

Error message

TextFileCSVImportProgressDialog.Exception.ErrorScanningFile

What it means

TextFileCSVImportProgressDialog.run wraps the CSV scanning work (doScan) executed inside an Eclipse IRunnableWithProgress. Any exception during scanning is rethrown as an InvocationTargetException whose message is TextFileCSVImportProgressDialog.Exception.ErrorScanningFile, including the row number, debug info, and the underlying exception text, so the import-progress dialog can surface the failure to the user.

Solutions

  1. Read the wrapped exception/row number in the dialog to locate the offending row and fix the data there
  2. Choose the correct character encoding and format (delimiter, enclosure) in the import dialog
  3. Confirm the file is readable, not locked, and not truncated mid-write
  4. Preview the file first to let the wizard detect the proper format before full scan

Example fix

// before: wrong charset for a UTF-8 file
String encoding = "ISO-8859-1"; // scan may blow up on multibyte chars
// after
String encoding = "UTF-8";
Defensive patterns

Strategy: try-catch

Validate before calling

// Java: pre-check the CSV file before invoking the import wizard
java.io.File f = new java.io.File( path );
if ( !f.canRead() || f.length() == 0 ) throw new IllegalStateException( "File unreadable: " + path );

Type guard

boolean csvReadable = path != null && new java.io.File( path ).canRead();

Try / catch

try { runImportScan(); } catch ( InvocationTargetException e ) { log.error( "Scan failed at row " + e.getTargetException().getMessage(), e ); }

Prevention

When it happens

Trigger: Importing a CSV file in the Text File Input wizard when doScan fails — e.g. IO error reading the file, character encoding problems, or severe parse errors while counting rows/detecting types at the failing row.

Common situations: File locked by another process or removed mid-scan; wrong charset chosen (garbled bytes breaking parsing); corrupt file content; permission issues; extremely malformed quoting that breaks the tokenizer.

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

Appendix: source

Thrown at ui/src/main/java/org/pentaho/di/ui/trans/steps/textfileinput/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 );
    }

View on GitHub (pinned to f3058517a1)