pentaho/pentaho-kettle · error · KettleStepException

e (no own message; error building CSV input fields)

Error message

e (no own message; error building CSV input fields)

What it means

CsvInputMeta.getFields() builds the output row layout (input fields plus optional filename/row-number columns) and rethrows any unexpected exception as a bare KettleStepException with no message. The cause (e.g. a field type/trim/type-conversion problem while constructing ValueMeta objects) is the only clue. It is raised during transformation initialization or preview updates.

Solutions

  1. Print/log e.getCause() — the message-less KettleStepException hides the real error.
  2. Open the CSV Input step dialog and re-confirm all fields have valid names, types, lengths and trim types.
  3. Delete and re-add the field list (or re-run metadata injection) to replace corrupted field metadata.
  4. Validate the transformation programmatically with check() before running to surface bad field definitions.

Example fix

// before: field added without a type
field.setName("amount"); // ValueMeta construction fails later
// after
field.setName("amount");
field.setType(ValueMetaInterface.TYPE_NUMBER); // explicit valid type
Defensive patterns

Strategy: validation

Validate before calling

for (CsvInputField f : meta.getInputFields()) {
  if (f.getName() == null || f.getName().isEmpty()) throw new IllegalArgumentException("Field without name");
  if (f.getTrimType() < 0 || f.getTrimType() > 3) throw new IllegalArgumentException("Invalid trim type for " + f.getName());
}

Try / catch

try { meta.getFields(row, origin, info, transMeta, stepMeta); }
catch (KettleStepException e) {
  Throwable cause = e.getCause();
  log.error("getFields failed for CSV Input {}", cause, cause);
}

Prevention

When it happens

Trigger: updatePreview / TransMeta pipeline composition calls getFields when any ValueMeta construction fails — e.g. null inputFields entries, invalid trim type codes, invalid length/precision combinations, or a NPE on an unconfigured field name.

Common situations: Transformation imported from an older version where field metadata is incomplete; metadata injection leaving fields partially configured; a field with null name or trim type code that getTrimTypeByCode cannot resolve.

Understand the failure class

Background: "Invalid value" and "allowed values are" config errors: what your library rejected and how to fix it — this error's family across 41 libraries.

Related errors


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

Appendix: source

Thrown at engine/src/main/java/org/pentaho/di/trans/steps/csvinput/CsvInputMeta.java:408

      if ( !Utils.isEmpty( filenameField ) && includingFilename ) {
        ValueMetaInterface filenameMeta = new ValueMetaString( filenameField );
        filenameMeta.setOrigin( origin );
        if ( lazyConversionActive ) {
          filenameMeta.setStorageType( ValueMetaInterface.STORAGE_TYPE_BINARY_STRING );
          filenameMeta.setStorageMetadata( new ValueMetaString( filenameField ) );
        }
        rowMeta.addValueMeta( filenameMeta );
      }

      if ( !Utils.isEmpty( rowNumField ) ) {
        ValueMetaInterface rowNumMeta = new ValueMetaInteger( rowNumField );
        rowNumMeta.setLength( 10 );
        rowNumMeta.setOrigin( origin );
        rowMeta.addValueMeta( rowNumMeta );
      }
    } catch ( Exception e ) {
      throw new KettleStepException( e );
    }

  }

  @Override
  public void check( List<CheckResultInterface> remarks, TransMeta transMeta, StepMeta stepMeta,
    RowMetaInterface prev, String[] input, String[] output, RowMetaInterface info, VariableSpace space,
    Repository repository, IMetaStore metaStore ) {
    CheckResult cr;
    if ( prev == null || prev.size() == 0 ) {
      cr =
        new CheckResult( CheckResultInterface.TYPE_RESULT_OK, BaseMessages.getString(
          PKG, "CsvInputMeta.CheckResult.NotReceivingFields" ), stepMeta );
      remarks.add( cr );
    } else {
      cr =
        new CheckResult( CheckResultInterface.TYPE_RESULT_ERROR, BaseMessages.getString(
          PKG, "CsvInputMeta.CheckResult.StepRecevingData", prev.size() + "" ), stepMeta );

View on GitHub (pinned to f3058517a1)