{"record":{"id":"3ea6b6f653d213b8","repo":"pentaho/pentaho-kettle","slug":"throw-new-kettleexception-e-getfilesrowscountmeta","errorCode":null,"errorMessage":"throw new KettleException( e );","messagePattern":"throw new KettleException\\( e \\);","errorType":"exception","errorClass":"KettleException","httpStatus":null,"severity":"error","filePath":"engine/src/main/java/org/pentaho/di/trans/steps/getfilesrowscount/GetFilesRowsCountMeta.java","lineNumber":689,"sourceCode":"  @Override\n  public String exportResources( Bowl executionBowl, Bowl globalManagementBowl, VariableSpace space,\n      Map<String, ResourceDefinition> definitions, ResourceNamingInterface namingInterface,\n      Repository repository, IMetaStore metaStore ) throws KettleException {\n    try {\n      // The object that we're modifying here is a copy of the original!\n      // So let's change the filename from relative to absolute by grabbing the file object...\n      // In case the name of the file comes from previous steps, forget about this!\n      //\n      if ( !filefield ) {\n        for ( int i = 0; i < fileName.length; i++ ) {\n          FileObject fileObject = KettleVFS.getInstance( executionBowl )\n            .getFileObject( space.environmentSubstitute( fileName[i] ), space );\n          fileName[i] = namingInterface.nameResource( fileObject, space, Utils.isEmpty( fileMask[i] ) );\n        }\n      }\n      return null;\n    } catch ( Exception e ) {\n      throw new KettleException( e );\n    }\n  }\n\n  @Override\n  public StepHelperInterface getStepHelperInterface() {\n    return new GetFilesRowCountHelper( this );\n  }\n\n}\n","sourceCodeStart":671,"sourceCodeEnd":699,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/engine/src/main/java/org/pentaho/di/trans/steps/getfilesrowscount/GetFilesRowsCountMeta.java#L671-L699","documentation":"GetFilesRowsCountMeta.exportResources() wraps any exception raised while rewriting the step's file names into repository-relative references during resource export into a bare KettleException. Export of the transformation's referenced files fails for this step.","triggerScenarios":"exportResources (public) runs during 'Export resources' when space.environmentSubstitute(fileName[i]) yields an invalid path or KettleVFS.getFileObject / nameResource throws (unresolvable VFS object, unsupported scheme).","commonSituations":"Exporting with unset environment variables producing malformed paths; filenames with illegal URI characters; network shares or SFTP targets unreachable during export.","solutions":["Correct the fileName entry so it resolves after variable substitution.","Ensure the VFS scheme/provider for each file is available.","Set all required environment variables before exporting.","Inspect the wrapped cause to identify the failing file at index i."],"exampleFix":"// before\nfileName[i] = \"${INPUT_DIR}/rows.txt\"; // INPUT_DIR unset -> getFileObject fails\n// after\nString resolved = space.environmentSubstitute(\"${INPUT_DIR}/rows.txt\");\nif (Utils.isEmpty(resolved) || resolved.contains(\"${\")) { logError(\"Variable INPUT_DIR not set\"); } else { fileName[i] = resolved; }","handlingStrategy":"validation","validationCode":"for (String f : meta.getFileName()) { String r = space.environmentSubstitute(f); if (Utils.isEmpty(r) || r.contains(\"${\")) throw new IllegalArgumentException(\"Unresolved variable in: \" + f); }","typeGuard":null,"tryCatchPattern":"try { exported = transMeta.exportResources(...); } catch (KettleException e) { log.error(\"Export failed: \" + e.getMessage(), e.getCause()); }","preventionTips":["Set all environment variables before exporting","Resolve and test each file path with KettleVFS first","Avoid illegal URI characters in file names","Export while referenced network locations are accessible"],"tags":["kettle","resource-export","vfs","variable-substitution"],"backgroundTag":"file-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"}