{"record":{"id":"68c6d76d14165489","repo":"pentaho/pentaho-kettle","slug":"csvinput-log-error-errorconvertingline-with-e-tostring","errorCode":null,"errorMessage":"CsvInput.Log.Error.ErrorConvertingLine (with e.toString())","messagePattern":"CsvInput\\.Log\\.Error\\.ErrorConvertingLine \\(with e\\.toString\\(\\)\\)","errorType":"exception","errorClass":"KettleException","httpStatus":null,"severity":"error","filePath":"engine/src/main/java/org/pentaho/di/trans/steps/csvinput/CsvInput.java","lineNumber":1157,"sourceCode":"        if ( contains_escaped_separators ) {\n          String replace = escapeCharacter + delimiter;\n          pol = Const.replace( pol, replace, delimiter );\n        }\n\n        // Now add pol to the strings found!\n        strings.add( pol );\n\n        pos = next + delimiter.length();\n      }\n      if ( pos == length ) {\n        if ( log.isRowLevel() ) {\n          log.logRowlevel( BaseMessages.getString( PKG, \"CsvInput.Log.ConvertLineToRowTitle\" ), BaseMessages\n            .getString( PKG, \"CsvInput.Log.EndOfEmptyLineFound\" ) );\n        }\n        strings.add( \"\" );\n      }\n    } catch ( Exception e ) {\n      throw new KettleException( BaseMessages.getString( PKG, \"CsvInput.Log.Error.ErrorConvertingLine\", e\n        .toString() ), e );\n    }\n\n    return strings.toArray( new String[ strings.size() ] );\n  }\n\n  String filenameValidatorForInputFiles( String filename ) {\n    Repository rep = getTransMeta().getRepository();\n    if ( rep != null && rep.isConnected() && filename\n      .contains( Const.INTERNAL_VARIABLE_ENTRY_CURRENT_DIRECTORY ) ) {\n      return environmentSubstitute( filename.replace( Const.INTERNAL_VARIABLE_ENTRY_CURRENT_DIRECTORY,\n        Const.INTERNAL_VARIABLE_TRANSFORMATION_FILENAME_DIRECTORY ) );\n    } else {\n      return environmentSubstitute( filename );\n    }\n  }\n\n}","sourceCodeStart":1139,"sourceCodeEnd":1175,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/engine/src/main/java/org/pentaho/di/trans/steps/csvinput/CsvInput.java#L1139-L1175","documentation":"guessStringsFromLine is used (e.g. by 'Get fields' / type-guessing preview) to convert a sample line to strings per configured field. Any unexpected exception during that sample conversion is wrapped in a KettleException whose message includes e.toString() via the ErrorConvertingLine key. It signals the sample line could not be processed with the current delimiter/enclosure/field settings.","triggerScenarios":"Exception inside the convertLineToRow logic on a preview/sample line: wrong delimiter or enclosure causing index problems, bad encoding bytes, or a field-conversion error during type guessing.","commonSituations":"Auto-detecting layouts against a file whose delimiter/enclosure settings are wrong; sample line contains binary/undecodable content; empty or malformed header samples.","solutions":["Read e.toString() in the message/cause to identify the actual conversion failure.","Correct the delimiter, enclosure, and encoding settings in the step dialog before running 'Get fields'.","Preview the raw file content and pick a sample line that matches the real record structure.","If a specific field type causes it, define fields manually instead of relying on guessing."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"// sanity-check delimiter/enclosure against a sample line before guessing\nString line = firstLineOf(filename);\nint delimCount = countOccurrences(line, delimiter);\nif (delimCount == 0) throw new IllegalStateException(\"Delimiter '\" + delimiter + \"' not present in sample line\");","typeGuard":null,"tryCatchPattern":"try { ... } catch (KettleException e) {\n  logError(\"Could not guess field types from sample line: \" + e.getMessage(), e);\n}","preventionTips":["Fix delimiter/enclosure settings before using 'Get fields'","Use a representative sample line for type guessing","Define fields manually when auto-guess fails repeatedly","Verify encoding so the sample line decodes cleanly"],"tags":["kettle","pentaho","type-guessing","conversion"],"backgroundTag":"invalid-argument-value","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"}