pentaho/pentaho-kettle · error · KettleConversionException

There were " + conversionExceptions.size() + " conversion…

Error message

There were " + conversionExceptions.size() + " conversion errors on line " + getLinesInput()

What it means

When a line contains values that cannot be converted to the declared field types, the step collects KettleConversionException items per field; instead of stopping at the first, it aggregates them and throws a KettleConversionException reporting the total count of conversion errors and the line number (getLinesInput). The first exception and the list of failing fields accompany the error.

Solutions

  1. Fix the offending data at line 'linesInput' reported in the message, or correct the field's type/format mask in the step's Fields tab.
  2. Set a conversion mask (format) matching the actual data, e.g. yyyy/MM/dd for dates or the right decimal separator.
  3. Enable error handling on the step (right-click → Define error handling) to route bad lines to an error stream instead of failing.
  4. Set the field type to String if no numeric/date conversion is actually needed.

Example fix

// before
field "amount", type=Number, format=(none)  // data: "1.234,56"
// after
field "amount", type=Number, format="#.###,##"  // or fix source data
Defensive patterns

Strategy: try-catch

Validate before calling

// validate numeric/date columns against their masks before the run
for (String v : row) {
  if (fieldType.equals("Number") && !v.isEmpty()) Double.valueOf(v.replace(',', '.')); // throws if invalid
}

Try / catch

try { ... } catch (KettleConversionException e) {
  logError("Line " + e.getLines() + ": conversion failed for fields " + java.util.Arrays.toString(e.getFields()), e);
  // enable step error handling to route bad rows instead of failing
  setErrors(1);
}

Prevention

When it happens

Trigger: readOneRow finishes converting a line and conversionExceptions is non-empty: e.g. a non-numeric string mapped to a Number field, malformed dates, or strings longer than the declared length with strict type conversion enabled.

Common situations: CSV data quality issues: empty or 'N/A' values in numeric columns, locale-dependent decimal separators, date formats not matching the field's format mask; wrong type declared in the step's field definitions.

Understand the failure class

Background: Type mismatch errors: IllegalArgumentException, TypeError and type guards across 150 open-source libraries — this error's family across 150 libraries.

Related errors


AI-assisted analysis of pentaho/pentaho-kettle@f3058517a1 (2026-09-13). Data as JSON: /api/errors/7b4c7259210e3da1. Report an issue: GitHub.

Appendix: source

Thrown at engine/src/main/java/org/pentaho/di/trans/steps/csvinput/CsvInput.java:851

        if ( meta.isLazyConversionActive() ) {
          outputRowData[ data.filenameFieldIndex ] = data.binaryFilename;
        } else {
          outputRowData[ data.filenameFieldIndex ] = data.filenames[ data.filenr - 1 ];
        }
      }

      if ( data.isAddingRowNumber ) {
        outputRowData[ data.rownumFieldIndex ] = data.rowNumber++;
      }

      if ( !ignoreEnclosures ) {
        incrementLinesInput();
      }

      if ( conversionExceptions != null && conversionExceptions.size() > 0 ) {
        // Forward the first exception
        //
        throw new KettleConversionException(
          "There were " + conversionExceptions.size() + " conversion errors on line " + getLinesInput(),
          conversionExceptions, exceptionFields, outputRowData );
      }

      return outputRowData;
    } catch ( KettleConversionException e ) {
      throw e;
    } catch ( IOException e ) {
      throw new KettleFileException( "Exception reading line using NIO", e );
    }
  }


  public boolean init( StepMetaInterface smi, StepDataInterface sdi ) {
    meta = (CsvInputMeta) smi;
    data = (CsvInputData) sdi;

    if ( super.init( smi, sdi ) ) {

View on GitHub (pinned to f3058517a1)