{"record":{"id":"c4c5cb6e2a49f44b","repo":"pentaho/pentaho-kettle","slug":"getfilesrowscount-exception-couldnotfindfield","errorCode":null,"errorMessage":"GetFilesRowsCount.Exception.CouldnotFindField","messagePattern":"GetFilesRowsCount\\.Exception\\.CouldnotFindField","errorType":"exception","errorClass":"KettleException","httpStatus":null,"severity":"error","filePath":"engine/src/main/java/org/pentaho/di/trans/steps/getfilesrowscount/GetFilesRowsCount.java","lineNumber":234,"sourceCode":"            metaStore );\n\n          // Get total previous fields\n          data.totalpreviousfields = data.inputRowMeta.size();\n\n          // Check is filename field is provided\n          if ( Utils.isEmpty( meta.setOutputFilenameField() ) ) {\n            logError( BaseMessages.getString( PKG, \"GetFilesRowsCount.Log.NoField\" ) );\n            throw new KettleException( BaseMessages.getString( PKG, \"GetFilesRowsCount.Log.NoField\" ) );\n          }\n\n          // cache the position of the field\n          if ( data.indexOfFilenameField < 0 ) {\n            data.indexOfFilenameField = getInputRowMeta().indexOfValue( meta.setOutputFilenameField() );\n            if ( data.indexOfFilenameField < 0 ) {\n              // The field is unreachable !\n              logError( BaseMessages.getString( PKG, \"GetFilesRowsCount.Log.ErrorFindingField\", meta\n                .setOutputFilenameField() ) );\n              throw new KettleException( BaseMessages.getString(\n                PKG, \"GetFilesRowsCount.Exception.CouldnotFindField\", meta.setOutputFilenameField() ) );\n            }\n          }\n\n        } // End if first\n\n        String filename = getInputRowMeta().getString( data.readrow, data.indexOfFilenameField );\n        if ( log.isDetailed() ) {\n          logDetailed( BaseMessages.getString( PKG, \"GetFilesRowsCount.Log.FilenameInStream\", meta\n            .setOutputFilenameField(), filename ) );\n        }\n\n        data.file = KettleVFS.getInstance( getTransMeta().getBowl() ).getFileObject( filename, getTransMeta() );\n\n        // Init Row number\n        if ( meta.isFileField() ) {\n          data.rownr = 0;\n        }","sourceCodeStart":216,"sourceCodeEnd":252,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/engine/src/main/java/org/pentaho/di/trans/steps/getfilesrowscount/GetFilesRowsCount.java#L216-L252","documentation":"GetFilesRowsCount.openNextFile() throws this KettleException (bundle key GetFilesRowsCount.Exception.CouldnotFindField) when the configured output filename field does not exist in the incoming row meta — indexOfValue returns -1. The step cannot read the file name from the row, so processing stops.","triggerScenarios":"On the first row, getInputRowMeta().indexOfValue(meta.setOutputFilenameField()) returns -1 because the field name configured on the step does not match any field produced by the previous step.","commonSituations":"Upstream step renamed or removed the field; case mismatch between configured name and actual field; inserting this step after a different source than originally designed.","solutions":["Correct the 'filename field name' in the step dialog to match an actual incoming field.","Check field names (and case) coming from the previous step via 'Preview'.","Add or restore the field upstream if it was removed.","Validate metadata with 'Verify transformations' before running."],"exampleFix":"// before\nmeta.setOutputFilenameField(\"Filename\"); // incoming field is \"filename\"\n// after\nmeta.setOutputFilenameField(\"filename\"); // matches input row meta exactly","handlingStrategy":"validation","validationCode":"String field = meta.setOutputFilenameField(); if (prevStreamRowMeta.indexOfValue(field) < 0) throw new IllegalArgumentException(\"Field not found in input rows: \" + field);","typeGuard":null,"tryCatchPattern":"try { transMeta.execute(...); } catch (KettleException e) { if (e.getMessage().contains(\"CouldnotFindField\")) { /* correct the configured field name to match upstream */ } throw e; }","preventionTips":["Use step Preview to confirm exact field names (case included)","Keep field names in sync when refactoring upstream steps","Rename fields at the source rather than guessing","Run metadata verification before production runs"],"tags":["kettle","field-not-found","row-meta","configuration"],"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"}