{"record":{"id":"a1fe37ea83006482","repo":"pentaho/pentaho-kettle","slug":"zipfile-exception-couldnotfindfield","errorCode":null,"errorMessage":"ZipFile.Exception.CouldnotFindField","messagePattern":"ZipFile\\.Exception\\.CouldnotFindField","errorType":"exception","errorClass":"KettleException","httpStatus":null,"severity":"error","filePath":"engine/src/main/java/org/pentaho/di/trans/steps/zipfile/ZipFile.java","lineNumber":98,"sourceCode":"      data.outputRowMeta = getInputRowMeta().clone();\n      meta.getFields( getTransMeta().getBowl(), data.outputRowMeta, getStepname(), null, null, this,\n        getTrans().getRepository(), getTrans().getMetaStore() );\n\n      // Check is source filename field is provided\n      if ( Utils.isEmpty( meta.getDynamicSourceFileNameField() ) ) {\n        throw new KettleException( BaseMessages.getString( PKG, \"ZipFile.Error.SourceFilenameFieldMissing\" ) );\n      }\n      // Check is target filename field is provided\n      if ( Utils.isEmpty( meta.getDynamicTargetFileNameField() ) ) {\n        throw new KettleException( BaseMessages.getString( PKG, \"ZipFile.Error.TargetFilenameFieldMissing\" ) );\n      }\n\n      // cache the position of the source filename field\n      if ( data.indexOfSourceFilename < 0 ) {\n        data.indexOfSourceFilename = getInputRowMeta().indexOfValue( meta.getDynamicSourceFileNameField() );\n        if ( data.indexOfSourceFilename < 0 ) {\n          // The field is unreachable !\n          throw new KettleException( BaseMessages.getString( PKG, \"ZipFile.Exception.CouldnotFindField\", meta\n            .getDynamicSourceFileNameField() ) );\n        }\n      }\n\n      data.indexOfZipFilename = getInputRowMeta().indexOfValue( meta.getDynamicTargetFileNameField() );\n      if ( data.indexOfZipFilename < 0 ) {\n        // The field is unreachable !\n        throw new KettleException( BaseMessages.getString( PKG, \"ZipFile.Exception.CouldnotFindField\", meta\n          .getDynamicTargetFileNameField() ) );\n      }\n\n      if ( meta.isKeepSouceFolder() ) {\n        if ( !Utils.isEmpty( meta.getBaseFolderField() ) ) {\n          // cache the position of the source filename field\n          data.indexOfBaseFolder = getInputRowMeta().indexOfValue( meta.getBaseFolderField() );\n          if ( data.indexOfBaseFolder < 0 ) {\n            // The field is unreachable !\n            throw new KettleException( BaseMessages.getString( PKG, \"ZipFile.Exception.CouldnotFindField\", meta","sourceCodeStart":80,"sourceCodeEnd":116,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/engine/src/main/java/org/pentaho/di/trans/steps/zipfile/ZipFile.java#L80-L116","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["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.","If you renamed the field upstream, update the Zip File step configuration accordingly.","Ensure the correct hop is connected — connect the step that actually emits the filename field.","Use a 'Select values' or 'Add constants' step upstream to guarantee the filename field exists with a stable name."],"exampleFix":"// before: configured field does not exist on the stream\nzipFileMeta.setDynamicSourceFileNameField( \"Filename\" ); // upstream field is \"filename\"\n\n// after: align with the actual upstream field name\nzipFileMeta.setDynamicSourceFileNameField( \"filename\" ); // exactly matches input row metadata","handlingStrategy":"validation","validationCode":"String configuredField = zipFileMeta.getDynamicSourceFileNameField();\nif ( configuredField != null && inputRowMeta.indexOfValue( configuredField ) < 0 ) {\n  throw new KettleException( \"Configured source field '\" + configuredField\n    + \"' not found in incoming row: \" + inputRowMeta.getFieldNames() );\n}","typeGuard":null,"tryCatchPattern":"try {\n  trans.execute( null );\n} catch ( KettleException e ) {\n  if ( e.getMessage() != null && e.getMessage().contains( \"CouldnotFindField\" ) ) {\n    logError( \"Field name mismatch: check upstream field names vs Zip File config\", e );\n  }\n}","preventionTips":["Match configured field names exactly, including case, to upstream output.","Preview rows upstream whenever you rename or add fields.","Use a 'Select values' step to enforce a stable field name before the Zip File step.","Re-check step configuration after reconnecting hops to different steps."],"tags":["pdi","zipfile","field-lookup","row-metadata"],"backgroundTag":"resource-not-found","analyzedSha":"f3058517a153da500bf4551f46d79b91bf8ec552","analyzedAt":"2026-09-13T14:04:16.340Z","contentChangedAt":"2026-09-13T14:04:16.340Z","schemaVersion":2},"datasetVersion":"2026-09-20T23:17:15.980Z"}