pentaho/pentaho-kettle · error · KettleException

Error parsing field #

Error message

Error parsing field #

What it means

In XBase.getRow(), for integer-typed DBF fields (FIELD_TYPE_I), the raw object is converted to a Double. A NumberFormatException during conversion is wrapped as 'Error parsing field #N : <fieldName>'. It indicates stored numeric data in that column cannot be represented as a number.

Solutions

  1. Inspect the reported field # and name in the offending record; open the DBF in a viewer to find bad values.
  2. Recover/re-export the DBF from its original source; repair with a DBF fix-up tool if rows are corrupted.
  3. Verify the DBF codepage/charset matches the data (e.g. 0x03 vs 0x65 language driver byte).
  4. If bad data must be tolerated, clean the column (blank invalid values) before PDI processing.

Example fix

// before: DBF stores '12a4' in an INTEGER column -> NumberFormatException
// after: repair data so column holds '124' or blank
Defensive patterns

Strategy: validation

Validate before calling

// Pre-scan: read rows via XBase.getRow(fields) in a try loop and log
// any field index that throws before running the full transformation
for (int i = 0; i < 10; i++) {
  try { xbase.getRow(fields); } catch (KettleException e) { /* flag bad column */ }
}

Try / catch

try {
  Object[] row = xbase.getRow(fields);
} catch (KettleException e) {
  if (e.getMessage().startsWith("Error parsing field #")) {
    // clean/repair the named column's data and retry
  }
}

Prevention

When it happens

Trigger: Calling getRow() on a record whose FIELD_TYPE_I column value (rowobj[i]) fails Integer-to-double conversion and triggers NumberFormatException — typically corrupt or non-numeric bytes in the column.

Common situations: Corrupted DBF rows after an abnormal writer exit; data written by a tool that stored text in a numeric column; encoding/codepage mismatch making digit bytes unreadable; truncated record area.

Understand the failure class

Background: "Invalid ... format", "must be in format X", "does not look like a ..." — invalid argument format errors across CLI tools and libraries — this error's family across 17 libraries.

Related errors


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

Appendix: source

Thrown at engine/src/main/java/org/pentaho/di/trans/steps/xbaseinput/XBase.java:185

      // Set the values in the row...
      //
      for ( int i = 0; i < reader.getFieldCount(); i++ ) {
        switch ( datatype[i] ) {
          case DBFField.FIELD_TYPE_M: // Memo
            if ( rowobj[i] != null ) {
              r[i] = rowobj[i];
            }
            break;
          case DBFField.FIELD_TYPE_C: // Character
            r[i] = Const.rtrim( (String) rowobj[i] );
            break;
          case FIELD_TYPE_I: // Numeric
            try {
              if ( rowobj[i] != null ) {
                r[i] = ( (Integer) rowobj[i] ).doubleValue();
              }
            } catch ( NumberFormatException e ) {
              throw new KettleException( "Error parsing field #"
                + ( i + 1 ) + " : " + reader.getField( i ).getName(), e );
            }
            break;
          case DBFField.FIELD_TYPE_N: // Numeric
            // Convert to Double!!
            try {
              if ( rowobj[i] != null ) {
                r[i] = rowobj[i];
              }
            } catch ( NumberFormatException e ) {
              throw new KettleException( "Error parsing field #"
                + ( i + 1 ) + " : " + reader.getField( i ).getName(), e );
            }
            break;
          case DBFField.FIELD_TYPE_F: // Float
            // Convert to double!!
            try {
              if ( rowobj[i] != null ) {

View on GitHub (pinned to f3058517a1)