pentaho/pentaho-kettle · error · KettleStepException

e (no own message; error creating value meta for constant…

Error message

e (no own message; error creating value meta for constant field)

What it means

In ConstantMeta.getFields, while building the output ValueMeta for each constant field, any exception (e.g. from ValueMeta construction/format parsing) is rethrown as KettleStepException(e) with no added message — the cause's message is all the developer sees.

Solutions

  1. Read the cause's message for which field/value meta failed
  2. Fix the offending field's type/format/length/precision in the Add Constants step
  3. Clear invalid conversion masks (empty if not needed) and ensure precision only on Number/BigNumber types
  4. Recreate the field entries in Spoon to reset metadata

Example fix

// before
field: rate, type: String, precision: 2  (invalid)
// after
field: rate, type: Number, precision: 2, length: 10
Defensive patterns

Strategy: validation

Validate before calling

// verify field definitions before building row meta
for (int i = 0; i < meta.getFieldName().length; i++) {
  if (Const.isEmpty(meta.getFieldName()[i]))
    throw new KettleStepException("Constant field " + i + " has no name");
}

Try / catch

try { meta.getFields(rowMeta, name, info, stepMeta, space, store); }
catch (KettleStepException e) { logError("Bad constant field definition: " + e.getMessage(), e); }

Prevention

When it happens

Trigger: Defining a Constant step field whose type/format/length/precision combination fails when constructing or configuring its ValueMeta while the step computes its output row layout.

Common situations: Invalid conversion mask strings, precision set on non-numeric types, negative/absurd lengths, or corrupted field metadata loaded from an old transformation.

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/31b45c08b102c5cb. Report an issue: GitHub.

Appendix: source

Thrown at engine/src/main/java/org/pentaho/di/trans/steps/constant/ConstantMeta.java:336

  @Override
  public void getFields( Bowl bowl, RowMetaInterface rowMeta, String name, RowMetaInterface[] info, StepMeta nextStep,
    VariableSpace space, Repository repository, IMetaStore metaStore ) throws KettleStepException {
    for ( int i = 0; i < fieldName.length; i++ ) {
      if ( fieldName[i] != null && fieldName[i].length() != 0 ) {
        int type = ValueMetaFactory.getIdForValueMeta( fieldType[i] );
        if ( type == ValueMetaInterface.TYPE_NONE ) {
          type = ValueMetaInterface.TYPE_STRING;
        }
        try {
          ValueMetaInterface v = ValueMetaFactory.createValueMeta( fieldName[i], type );
          v.setLength( fieldLength[i] );
          v.setPrecision( fieldPrecision[i] );
          v.setOrigin( name );
          v.setConversionMask( fieldFormat[i] );
          rowMeta.addValueMeta( v );
        } catch ( Exception e ) {
          throw new KettleStepException( e );
        }
      }
    }
  }

  public String getXML() {
    StringBuilder retval = new StringBuilder( 300 );

    retval.append( "    <fields>" ).append( Const.CR );
    for ( int i = 0; i < fieldName.length; i++ ) {
      if ( fieldName[i] != null && fieldName[i].length() != 0 ) {
        retval.append( "      <field>" ).append( Const.CR );
        retval.append( "        " ).append( XMLHandler.addTagValue( "name", fieldName[i] ) );
        retval.append( "        " ).append( XMLHandler.addTagValue( "type", fieldType[i] ) );
        retval.append( "        " ).append( XMLHandler.addTagValue( "format", fieldFormat[i] ) );
        retval.append( "        " ).append( XMLHandler.addTagValue( "currency", currency[i] ) );
        retval.append( "        " ).append( XMLHandler.addTagValue( "decimal", decimal[i] ) );
        retval.append( "        " ).append( XMLHandler.addTagValue( "group", group[i] ) );

View on GitHub (pinned to f3058517a1)