pentaho/pentaho-kettle · error · KettleException

CsvInput.Log.Error.ErrorConvertingLine (with e.toString())

Error message

CsvInput.Log.Error.ErrorConvertingLine (with e.toString())

What it means

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.

Solutions

  1. Read e.toString() in the message/cause to identify the actual conversion failure.
  2. Correct the delimiter, enclosure, and encoding settings in the step dialog before running 'Get fields'.
  3. Preview the raw file content and pick a sample line that matches the real record structure.
  4. If a specific field type causes it, define fields manually instead of relying on guessing.
Defensive patterns

Strategy: try-catch

Validate before calling

// sanity-check delimiter/enclosure against a sample line before guessing
String line = firstLineOf(filename);
int delimCount = countOccurrences(line, delimiter);
if (delimCount == 0) throw new IllegalStateException("Delimiter '" + delimiter + "' not present in sample line");

Try / catch

try { ... } catch (KettleException e) {
  logError("Could not guess field types from sample line: " + e.getMessage(), e);
}

Prevention

When it happens

Trigger: 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.

Common situations: Auto-detecting layouts against a file whose delimiter/enclosure settings are wrong; sample line contains binary/undecodable content; empty or malformed header samples.

Understand the failure class

Background: "Must be a positive integer", "Invalid value", "Unsupported": the invalid-argument-value error family, when a library rejects the value you pass — this error's family across 35 libraries.

Related errors


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

Appendix: source

Thrown at engine/src/main/java/org/pentaho/di/trans/steps/csvinput/CsvInput.java:1157

        if ( contains_escaped_separators ) {
          String replace = escapeCharacter + delimiter;
          pol = Const.replace( pol, replace, delimiter );
        }

        // Now add pol to the strings found!
        strings.add( pol );

        pos = next + delimiter.length();
      }
      if ( pos == length ) {
        if ( log.isRowLevel() ) {
          log.logRowlevel( BaseMessages.getString( PKG, "CsvInput.Log.ConvertLineToRowTitle" ), BaseMessages
            .getString( PKG, "CsvInput.Log.EndOfEmptyLineFound" ) );
        }
        strings.add( "" );
      }
    } catch ( Exception e ) {
      throw new KettleException( BaseMessages.getString( PKG, "CsvInput.Log.Error.ErrorConvertingLine", e
        .toString() ), e );
    }

    return strings.toArray( new String[ strings.size() ] );
  }

  String filenameValidatorForInputFiles( String filename ) {
    Repository rep = getTransMeta().getRepository();
    if ( rep != null && rep.isConnected() && filename
      .contains( Const.INTERNAL_VARIABLE_ENTRY_CURRENT_DIRECTORY ) ) {
      return environmentSubstitute( filename.replace( Const.INTERNAL_VARIABLE_ENTRY_CURRENT_DIRECTORY,
        Const.INTERNAL_VARIABLE_TRANSFORMATION_FILENAME_DIRECTORY ) );
    } else {
      return environmentSubstitute( filename );
    }
  }

}

View on GitHub (pinned to f3058517a1)