pentaho/pentaho-kettle · error · KettleException

Can not find field [ ] in the input stream!

Error message

Can not find field [{0}] in the input stream!

What it means

SetValueConstant.processRow() throws KettleException 'SetValueConstant.Log.CanNotFindField' when indexOfValue() returns -1 for a configured field name, i.e. the field is absent from the step's input row stream. The step cannot replace a value in a field that does not exist.

Solutions

  1. Add the missing field upstream or correct the field name in the step's Fields grid
  2. Refresh upstream step field lists and re-enter the name exactly
  3. Enable variable substitution check: if 'use variable' is set, ensure the variable resolves to a real field name
  4. Re-run after verifying with 'View input fields' on the step

Example fix

// before: Fields tab has name='custmomer_id'
// after
// Fields tab name corrected to 'customer_id'
Defensive patterns

Strategy: validation

Validate before calling

for (SetValueConstantMeta.Field f : meta.getField()) {
  if (inputRowMeta.indexOfValue(f.getFieldName()) < 0)
    throw new IllegalStateException("Input stream missing field: " + f.getFieldName());
}

Type guard

boolean fieldPresent(RowMetaInterface row, String name) { return row != null && name != null && row.indexOfValue(name) >= 0; }

Try / catch

try { step.processRow(); } catch (KettleException e) { if (e.getMessage().startsWith("Can not find field")) { /* fix field names upstream */ } else throw e; }

Prevention

When it happens

Trigger: First row processing when data.getFieldnrs()[i] < 0 for the field named in the Fields tab — the field was renamed/removed upstream or the name contains typos/extra whitespace.

Common situations: Upstream step schema changed (renamed or dropped column); field name entered with wrong case/spaces; transformation run against a different input source than when designed.

Understand the failure class

Background: 'Could not be found', 'does not exist', 'not found in database': the resource-not-found family when an ID, slug, key, or URI lookup comes back empty — this error's family across 20 libraries.

Related errors


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

Appendix: source

Thrown at engine/src/main/java/org/pentaho/di/trans/steps/setvalueconstant/SetValueConstant.java:96

      int size = fields.size();
      if ( !Utils.isEmpty( fields ) ) {
        data.setFieldnrs( new int[size] );
        data.setRealReplaceByValues( new String[size] );
        for ( int i = 0; i < size; i++ ) {
          // Check if this field was specified only one time
          final SetValueConstantMeta.Field check = fields.get( i );
          for ( SetValueConstantMeta.Field field : fields ) {
            if ( field.getFieldName() != null && field != check && field.getFieldName().equalsIgnoreCase( check.getFieldName() ) ) {
              throw new KettleException( BaseMessages.getString( PKG, "SetValueConstant.Log"
                      + ".FieldSpecifiedMoreThatOne", check.getFieldName() ) );
            }
          }

          data.getFieldnrs()[i] = data.getOutputRowMeta().indexOfValue( meta.getField( i ).getFieldName() );

          if ( data.getFieldnrs()[i] < 0 ) {
            logError( BaseMessages.getString( PKG, "SetValueConstant.Log.CanNotFindField", meta.getField( i ).getFieldName() ) );
            throw new KettleException( BaseMessages.getString( PKG, "SetValueConstant.Log.CanNotFindField", meta
              .getField( i ).getFieldName() ) );
          }

          if ( meta.getField( i ).isEmptyString() ) {
            // Just set empty string
            data.getRealReplaceByValues()[i] = StringUtil.EMPTY_STRING;
          } else {
            // set specified value
            if ( meta.isUseVars() ) {
              data.getRealReplaceByValues()[i] = environmentSubstitute( meta.getField( i ).getReplaceValue() );
            } else {
              data.getRealReplaceByValues()[i] = meta.getField( i ).getReplaceValue();
            }
          }
        }
      } else {
        throw new KettleException( BaseMessages.getString( PKG, "SetValueConstant.Log.SelectFieldsEmpty" ) );
      }

View on GitHub (pinned to f3058517a1)