pentaho/pentaho-kettle · error · KettleException

ZipFile.Exception.CouldnotFindField

Error message

ZipFile.Exception.CouldnotFindField

What it means

Thrown in ZipFile.processRow() when the configured source filename field cannot be found in the incoming row's RowMeta (indexOfValue returns -1). Unlike 2517/2518 this is a metadata-vs-data mismatch: the field name is configured but does not exist on the actual stream at runtime.

Solutions

  1. Check the exact incoming field names (via an upstream 'Fields' view or a dummy/preview) and fix the 'Source filename fieldname' to match exactly, including case.
  2. If you renamed the field upstream, update the Zip File step configuration accordingly.
  3. Ensure the correct hop is connected — connect the step that actually emits the filename field.
  4. Use a 'Select values' or 'Add constants' step upstream to guarantee the filename field exists with a stable name.

Example fix

// before: configured field does not exist on the stream
zipFileMeta.setDynamicSourceFileNameField( "Filename" ); // upstream field is "filename"

// after: align with the actual upstream field name
zipFileMeta.setDynamicSourceFileNameField( "filename" ); // exactly matches input row metadata
Defensive patterns

Strategy: validation

Validate before calling

String configuredField = zipFileMeta.getDynamicSourceFileNameField();
if ( configuredField != null && inputRowMeta.indexOfValue( configuredField ) < 0 ) {
  throw new KettleException( "Configured source field '" + configuredField
    + "' not found in incoming row: " + inputRowMeta.getFieldNames() );
}

Try / catch

try {
  trans.execute( null );
} catch ( KettleException e ) {
  if ( e.getMessage() != null && e.getMessage().contains( "CouldnotFindField" ) ) {
    logError( "Field name mismatch: check upstream field names vs Zip File config", e );
  }
}

Prevention

When it happens

Trigger: First processRow(): data.indexOfSourceFilename < 0 after getInputRowMeta().indexOfValue(meta.getDynamicSourceFileNameField()); i.e. the configured field name is absent from the input row, triggering 'ZipFile.Exception.CouldnotFindField' with the field name interpolated.

Common situations: Renamed or removed the field in an upstream step without updating the Zip File dialog, case mismatch between configured and actual field name, connecting a different hop whose layout differs from what the step was configured against, field only exists conditionally upstream.

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

Appendix: source

Thrown at engine/src/main/java/org/pentaho/di/trans/steps/zipfile/ZipFile.java:98

      data.outputRowMeta = getInputRowMeta().clone();
      meta.getFields( getTransMeta().getBowl(), data.outputRowMeta, getStepname(), null, null, this,
        getTrans().getRepository(), getTrans().getMetaStore() );

      // Check is source filename field is provided
      if ( Utils.isEmpty( meta.getDynamicSourceFileNameField() ) ) {
        throw new KettleException( BaseMessages.getString( PKG, "ZipFile.Error.SourceFilenameFieldMissing" ) );
      }
      // Check is target filename field is provided
      if ( Utils.isEmpty( meta.getDynamicTargetFileNameField() ) ) {
        throw new KettleException( BaseMessages.getString( PKG, "ZipFile.Error.TargetFilenameFieldMissing" ) );
      }

      // cache the position of the source filename field
      if ( data.indexOfSourceFilename < 0 ) {
        data.indexOfSourceFilename = getInputRowMeta().indexOfValue( meta.getDynamicSourceFileNameField() );
        if ( data.indexOfSourceFilename < 0 ) {
          // The field is unreachable !
          throw new KettleException( BaseMessages.getString( PKG, "ZipFile.Exception.CouldnotFindField", meta
            .getDynamicSourceFileNameField() ) );
        }
      }

      data.indexOfZipFilename = getInputRowMeta().indexOfValue( meta.getDynamicTargetFileNameField() );
      if ( data.indexOfZipFilename < 0 ) {
        // The field is unreachable !
        throw new KettleException( BaseMessages.getString( PKG, "ZipFile.Exception.CouldnotFindField", meta
          .getDynamicTargetFileNameField() ) );
      }

      if ( meta.isKeepSouceFolder() ) {
        if ( !Utils.isEmpty( meta.getBaseFolderField() ) ) {
          // cache the position of the source filename field
          data.indexOfBaseFolder = getInputRowMeta().indexOfValue( meta.getBaseFolderField() );
          if ( data.indexOfBaseFolder < 0 ) {
            // The field is unreachable !
            throw new KettleException( BaseMessages.getString( PKG, "ZipFile.Exception.CouldnotFindField", meta

View on GitHub (pinned to f3058517a1)