{"record":{"id":"3522eaf16b7c5afc","repo":"pentaho/pentaho-kettle","slug":"textfileinput-log-error-errorconvertinglinetext","errorCode":"TextFileInput.Log.Error.ErrorConvertingLineText","errorMessage":"TextFileInput.Log.Error.ErrorConvertingLineText","messagePattern":"TextFileInput\\.Log\\.Error\\.ErrorConvertingLineText","errorType":"exception","errorClass":"KettleException","httpStatus":null,"severity":"error","filePath":"engine/src/main/java/org/pentaho/di/trans/steps/fileinput/text/TextFileInputUtils.java","lineNumber":643,"sourceCode":"        }\n        // Add modification date\n        if ( additionalOutputFields.lastModificationField != null ) {\n          r[index] = modificationDateTime;\n          index++;\n        }\n        // Add Uri\n        if ( additionalOutputFields.uriField != null ) {\n          r[index] = uri;\n          index++;\n        }\n        // Add RootUri\n        if ( additionalOutputFields.rootUriField != null ) {\n          r[index] = rooturi;\n          index++;\n        }\n      } // End if r != null\n    } catch ( Exception e ) {\n      throw new KettleException( BaseMessages.getString( PKG, \"TextFileInput.Log.Error.ErrorConvertingLineText\" ), e );\n    }\n\n    if ( r != null && passThruFields != null ) {\n      // Simply add all fields from source files step\n      for ( int i = 0; i < nrPassThruFields; i++ ) {\n        r[i] = passThruFields[i];\n      }\n    }\n\n    return r;\n  }\n\n  public static final String[] convertLineToStrings( LogChannelInterface log, String line, TextFileInputMeta inf,\n      String delimiter, String enclosure, String escapeCharacters ) throws KettleException {\n    String[] strings = new String[inf.inputFields.length];\n    int fieldnr;\n\n    String pol; // piece of line","sourceCodeStart":625,"sourceCodeEnd":661,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/engine/src/main/java/org/pentaho/di/trans/steps/fileinput/text/TextFileInputUtils.java#L625-L661","documentation":"TextFileInputUtils.convertLineToRow() converts a raw text line into a Kettle row using the field definitions (types, masks, delimiters, extra output fields). Any exception in that conversion is wrapped in a KettleException with message TextFileInput.Log.Error.ErrorConvertingLineText. The step-level error handling may divert it, but unhandled it stops the step.","triggerScenarios":"Calling convertLineToRow during step processing when a field value cannot be parsed into its configured type (bad number/date against the mask), the row layout/indexing fails, or populating additional output fields (rootUri etc.) throws.","commonSituations":"Data rows not matching the declared field types (letters in a numeric column); date strings not matching the conversion mask; wrong number of columns vs defined fields with strict handling; trim/encoding settings corrupting values before conversion.","solutions":["Read the chained cause to find which field value failed to convert.","Fix the data or relax the field type (e.g. use String instead of Number for dirty columns).","Correct the conversion masks (date/number formats) in the Fields tab to match the actual data.","Enable the step's error handling (errorIgnored with error/field count targets) to route bad lines to an error stream instead of failing.","Configure the Encoding and trim type to preserve/normalize values before conversion."],"exampleFix":"// before: date mask does not match data\nfield.setFormat(\"yyyy-MM-dd\"); // data is 31/12/2024\n// after: mask matches the data\nfield.setFormat(\"dd/MM/yyyy\");","handlingStrategy":"fallback","validationCode":"// dry-run conversion of each field before running the transformation\nfor (TextFileInputField f : meta.inputFields) {\n  if (f.getFormat() != null && f.getType() == ValueMetaInterface.TYPE_NUMBER)\n    new DecimalFormat(f.getFormat()); // throws early on bad mask\n}\nif (sampleLine.split(Pattern.quote(meta.getDelimiter())).length < meta.inputFields.length)\n  log.logBasic(\"Warning: data rows have fewer columns than defined fields\");","typeGuard":"if (line == null || line.isEmpty() || meta.inputFields == null || meta.inputFields.length == 0) return null; // nothing convertible","tryCatchPattern":"try {\n  Object[] row = TextFileInputUtils.convertLineToRow(...);\n} catch (KettleException e) {\n  if (meta.isErrorLineSkipped()) {\n    log.logBasic(\"Skipped bad line: \" + e.getCause());\n    // route to error stream via step error handling\n  } else throw e;\n}","preventionTips":["Configure step error handling (error count/fields targets) for dirty data files.","Test masks/types with a preview of real data before full runs.","Use String type for heterogeneous columns and convert downstream.","Verify column counts and delimiters match the actual files."],"tags":["kettle","etl","data-conversion","row-processing"],"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"}