{"record":{"id":"c2341641a87ffa10","repo":"pentaho/pentaho-kettle","slug":"error-parsing-field","errorCode":null,"errorMessage":"Error parsing field #","messagePattern":"Error parsing field #","errorType":"exception","errorClass":"KettleException","httpStatus":null,"severity":"error","filePath":"engine/src/main/java/org/pentaho/di/trans/steps/xbaseinput/XBase.java","lineNumber":185,"sourceCode":"      // Set the values in the row...\n      //\n      for ( int i = 0; i < reader.getFieldCount(); i++ ) {\n        switch ( datatype[i] ) {\n          case DBFField.FIELD_TYPE_M: // Memo\n            if ( rowobj[i] != null ) {\n              r[i] = rowobj[i];\n            }\n            break;\n          case DBFField.FIELD_TYPE_C: // Character\n            r[i] = Const.rtrim( (String) rowobj[i] );\n            break;\n          case FIELD_TYPE_I: // Numeric\n            try {\n              if ( rowobj[i] != null ) {\n                r[i] = ( (Integer) rowobj[i] ).doubleValue();\n              }\n            } catch ( NumberFormatException e ) {\n              throw new KettleException( \"Error parsing field #\"\n                + ( i + 1 ) + \" : \" + reader.getField( i ).getName(), e );\n            }\n            break;\n          case DBFField.FIELD_TYPE_N: // Numeric\n            // Convert to Double!!\n            try {\n              if ( rowobj[i] != null ) {\n                r[i] = rowobj[i];\n              }\n            } catch ( NumberFormatException e ) {\n              throw new KettleException( \"Error parsing field #\"\n                + ( i + 1 ) + \" : \" + reader.getField( i ).getName(), e );\n            }\n            break;\n          case DBFField.FIELD_TYPE_F: // Float\n            // Convert to double!!\n            try {\n              if ( rowobj[i] != null ) {","sourceCodeStart":167,"sourceCodeEnd":203,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/engine/src/main/java/org/pentaho/di/trans/steps/xbaseinput/XBase.java#L167-L203","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Inspect the reported field # and name in the offending record; open the DBF in a viewer to find bad values.","Recover/re-export the DBF from its original source; repair with a DBF fix-up tool if rows are corrupted.","Verify the DBF codepage/charset matches the data (e.g. 0x03 vs 0x65 language driver byte).","If bad data must be tolerated, clean the column (blank invalid values) before PDI processing."],"exampleFix":"// before: DBF stores '12a4' in an INTEGER column -> NumberFormatException\n// after: repair data so column holds '124' or blank","handlingStrategy":"validation","validationCode":"// Pre-scan: read rows via XBase.getRow(fields) in a try loop and log\n// any field index that throws before running the full transformation\nfor (int i = 0; i < 10; i++) {\n  try { xbase.getRow(fields); } catch (KettleException e) { /* flag bad column */ }\n}","typeGuard":null,"tryCatchPattern":"try {\n  Object[] row = xbase.getRow(fields);\n} catch (KettleException e) {\n  if (e.getMessage().startsWith(\"Error parsing field #\")) {\n    // clean/repair the named column's data and retry\n  }\n}","preventionTips":["Sanity-check exported DBF data with a viewer before ETL runs.","Match DBF codepage to the data's character encoding.","Restore from a clean source when records look corrupted.","Blank invalid numeric values at the exporting system, not downstream."],"tags":["dbf","xbase","data-parsing","numeric","kettle"],"backgroundTag":"invalid-argument-format","analyzedSha":"f3058517a153da500bf4551f46d79b91bf8ec552","analyzedAt":"2026-09-13T14:04:16.340Z","contentChangedAt":"2026-09-13T14:04:16.340Z","schemaVersion":2},"datasetVersion":"2026-09-20T23:17:15.980Z"}