{"record":{"id":"8f53b6befbf23611","repo":"pentaho/pentaho-kettle","slug":"textfileinput-log-error-errorconvertinglinetext-8f53b6","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/textfileinput/TextFileInput.java","lineNumber":838,"sourceCode":"          r[index] = uri;\n          index++;\n        }\n        // Add RootUri\n        if ( addRootUri ) {\n          r[index] = rooturi;\n          index++;\n        }\n\n        if ( 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      } // End if r != null\n    } catch ( Exception e ) {\n      throw new KettleException( BaseMessages.getString( PKG, \"TextFileInput.Log.Error.ErrorConvertingLineText\" ), e );\n    }\n\n    return r;\n\n  }\n\n  @Override\n  public boolean processRow( StepMetaInterface smi, StepDataInterface sdi ) throws KettleException {\n    data = (TextFileInputData) sdi;\n    meta = (TextFileInputMeta) smi;\n    Object[] r = null;\n    boolean retval = true;\n    boolean putrow = false;\n\n    if ( first ) { // we just got started\n\n      first = false;\n","sourceCodeStart":820,"sourceCodeEnd":856,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/engine/src/main/java/org/pentaho/di/trans/steps/textfileinput/TextFileInput.java#L820-L856","documentation":"convertLineToRow() wraps any unexpected exception in the overall line-to-row conversion (splitting, pass-through field copying, row construction) into a KettleException with the 'Error converting line to text' message. It is the outermost guard for the row-conversion path, so its cause can be nearly any downstream parsing error.","triggerScenarios":"Any exception during row assembly: converter failures, array/index problems when mapping parsed tokens to fields, or passThruFields handling errors — whenever not already handled by the more specific per-field path.","commonSituations":"Field definitions out of sync with actual column count, metadata changed after files were produced, null converters, or corrupted/very long lines breaking token mapping.","solutions":["Inspect the attached cause exception for the concrete failure.","Re-run 'Get Fields' or verify the Fields tab matches the file's current column layout.","Enable step error handling to capture and inspect offending lines.","Test the exact failing line in isolation via the step's preview to reproduce and debug."],"exampleFix":"// before: Fields tab defines 5 columns but the file now has 7 (index issues during row build)\n// after: refresh field definitions to match the current file layout\n//   (Fields tab -> 'Get Fields from header...' -> verify types/formats)","handlingStrategy":"try-catch","validationCode":"// Check token count vs configured fields before conversion\nString[] tokens = line.split(Pattern.quote(delimiter), -1);\nif (tokens.length != configuredFieldCount) {\n  log.warn(\"Column mismatch: expected \" + configuredFieldCount + \" got \" + tokens.length);\n}","typeGuard":null,"tryCatchPattern":"try {\n  row = convertLineToRow(line);\n} catch (KettleException e) {\n  Throwable cause = e.getCause();\n  logError(\"Row conversion failed (\" + cause + \") for line: \" + line);\n  routeToErrorStream(line, cause);\n}","preventionTips":["Re-run 'Get Fields' whenever the source format changes","Use preview mode on production-like data before scheduling","Enable error handling so a single bad line doesn't kill the run"],"tags":["row-processing","file-parsing","text-file-input"],"backgroundTag":"file-read-failed","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"}