{"record":{"id":"af620f109bf0053a","repo":"pentaho/pentaho-kettle","slug":"throw-new-kettleexception-e-getfilenamesmeta","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/getfilenames/GetFileNamesMeta.java","lineNumber":827,"sourceCode":"      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\n        // Replace the filename ONLY (folder or filename)\n        //\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 GetFileNamesHelper( this );\n  }\n}\n","sourceCodeStart":809,"sourceCodeEnd":836,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/engine/src/main/java/org/pentaho/di/trans/steps/getfilenames/GetFileNamesMeta.java#L809-L836","documentation":"GetFileNamesMeta.exportResources() wraps any exception that occurs while converting the step's hard-coded file names into repository-relative references (via NameResourceInterface.nameResource) into a bare KettleException. It means resource exporting for this step failed, typically because a file object could not be resolved against the variable space.","triggerScenarios":"Exporting a transformation's resources when space.environmentSubstitute(fileName[i]) points to a non-resolvable/invalid path, or KettleVFS.getFileObject / nameResource throws (VFS error, bad URI, missing file system plugin).","commonSituations":"Exporting with environment variables unset so substituted paths are malformed; filenames containing illegal VFS scheme characters; referencing network shares unavailable during export.","solutions":["Fix the fileName entry at index i so it resolves to a valid path after variable substitution.","Verify the VFS scheme prefix (file:, sftp:, etc.) is correct and the provider is available.","Set required Kettle environment variables before exporting.","Inspect the wrapped cause for the precise VFS failure."],"exampleFix":"// before\nString file = \"${MY_DIR}/data.csv\"; // MY_DIR unset -> invalid substitution\n// after\nString file = space.environmentSubstitute(\"${MY_DIR}/data.csv\");\nif (Utils.isEmpty(file) || !file.contains(\":\") && !new File(file).exists()) { logError(\"Unresolved: \" + file); }","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 file name: \" + f); }","typeGuard":null,"tryCatchPattern":"try { transMeta.exportResources(...); } catch (KettleException e) { log.error(\"Resource export failed: \" + e.getMessage(), e); }","preventionTips":["Define all used variables before export","Test file paths with KettleVFS.fileExists() first","Use valid VFS scheme prefixes","Export from an environment where referenced shares are reachable"],"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"}