pentaho/pentaho-kettle · error · KettleException

ColumnExists.Exception.CouldnotFindField

Error message

ColumnExists.Exception.CouldnotFindField

What it means

The step is configured to take the table name from a field, but that field name does not exist in the incoming row metadata, so indexOfValue returns -1 and the step throws a KettleStepException naming the missing field.

Solutions

  1. Correct the 'tablename fieldname' in the step dialog to match an actual upstream field name
  2. Inspect the incoming row (Preview / Get Fields) to confirm the field exists upstream
  3. Add or restore the field in an upstream step if it was removed

Example fix

// before: field 'tab_name' typo
meta.setDynamicTablenameField("tab_name");
// after
meta.setDynamicTablenameField("TABLE_NAME"); // matches upstream field exactly
Defensive patterns

Strategy: validation

Validate before calling

String field = meta.getDynamicTablenameField();
if (inputRowMeta.indexOfValue(field) < 0) {
  throw new IllegalArgumentException("Upstream row is missing tablename field: " + field);
}

Try / catch

try { transform.execute(); } catch (KettleStepException e) { log.error("Field lookup failed: " + e.getMessage()); }

Prevention

When it happens

Trigger: In processRow, getInputRowMeta().indexOfValue(meta.getDynamicTablenameField()) < 0 — the configured dynamic tablename field is absent from the upstream row layout.

Common situations: Upstream step renamed or removed the field; typo in the field name; field added downstream instead of upstream; a Select Values step dropped the column.

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/90df85719e4cb3e6. Report an issue: GitHub.

Appendix: source

Thrown at plugins/core/impl/src/main/java/org/pentaho/di/trans/steps/columnexists/ColumnExists.java:87

      if ( Utils.isEmpty( meta.getDynamicColumnnameField() ) ) {
        logError( BaseMessages.getString( PKG, "ColumnExists.Error.ColumnnameFieldMissing" ) );
        throw new KettleException( BaseMessages.getString( PKG, "ColumnExists.Error.ColumnnameFieldMissing" ) );
      }
      if ( meta.isTablenameInField() ) {
        // Check is tablename field is provided
        if ( Utils.isEmpty( meta.getDynamicTablenameField() ) ) {
          logError( BaseMessages.getString( PKG, "ColumnExists.Error.TablenameFieldMissing" ) );
          throw new KettleException( BaseMessages.getString( PKG, "ColumnExists.Error.TablenameFieldMissing" ) );
        }

        // cache the position of the field
        if ( data.indexOfTablename < 0 ) {
          data.indexOfTablename = getInputRowMeta().indexOfValue( meta.getDynamicTablenameField() );
          if ( data.indexOfTablename < 0 ) {
            // The field is unreachable !
            logError( BaseMessages.getString( PKG, "ColumnExists.Exception.CouldnotFindField" ) + "["
                + meta.getDynamicTablenameField() + "]" );
            throw new KettleException( BaseMessages.getString( PKG, "ColumnExists.Exception.CouldnotFindField",
              meta.getDynamicTablenameField() ) );
          }
        }
      } else {
        if ( !Utils.isEmpty( data.schemaname ) ) {
          data.tablename = data.db.getDatabaseMeta().getQuotedSchemaTableCombination( data.schemaname, data.tablename );
        } else {
          data.tablename = data.db.getDatabaseMeta().quoteField( data.tablename );
        }
      }

      // cache the position of the column field
      if ( data.indexOfColumnname < 0 ) {
        data.indexOfColumnname = getInputRowMeta().indexOfValue( meta.getDynamicColumnnameField() );
        if ( data.indexOfColumnname < 0 ) {
          // The field is unreachable !
          logError( BaseMessages.getString( PKG, "ColumnExists.Exception.CouldnotFindField" ) + "["
              + meta.getDynamicColumnnameField() + "]" );

View on GitHub (pinned to f3058517a1)