pentaho/pentaho-kettle · error · KettleException

throw new KettleException( e );

Error message

throw new KettleException( e );

What it means

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.

Solutions

  1. Correct the fileName entry so it resolves after variable substitution.
  2. Ensure the VFS scheme/provider for each file is available.
  3. Set all required environment variables before exporting.
  4. Inspect the wrapped cause to identify the failing file at index i.

Example fix

// before
fileName[i] = "${INPUT_DIR}/rows.txt"; // INPUT_DIR unset -> getFileObject fails
// after
String resolved = space.environmentSubstitute("${INPUT_DIR}/rows.txt");
if (Utils.isEmpty(resolved) || resolved.contains("${")) { logError("Variable INPUT_DIR not set"); } else { fileName[i] = resolved; }
Defensive patterns

Strategy: validation

Validate before calling

for (String f : meta.getFileName()) { String r = space.environmentSubstitute(f); if (Utils.isEmpty(r) || r.contains("${")) throw new IllegalArgumentException("Unresolved variable in: " + f); }

Try / catch

try { exported = transMeta.exportResources(...); } catch (KettleException e) { log.error("Export failed: " + e.getMessage(), e.getCause()); }

Prevention

When it happens

Trigger: 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).

Common situations: Exporting with unset environment variables producing malformed paths; filenames with illegal URI characters; network shares or SFTP targets unreachable during export.

Understand the failure class

Background: "File not found" and ENOENT errors: why libraries can't find a file that should exist — this error's family across 50 libraries.

Related errors


AI-assisted analysis of pentaho/pentaho-kettle@f3058517a1 (2026-09-13). Data as JSON: /api/errors/3ea6b6f653d213b8. Report an issue: GitHub.

Appendix: source

Thrown at engine/src/main/java/org/pentaho/di/trans/steps/getfilesrowscount/GetFilesRowsCountMeta.java:689

  @Override
  public String exportResources( Bowl executionBowl, Bowl globalManagementBowl, VariableSpace space,
      Map<String, ResourceDefinition> definitions, ResourceNamingInterface namingInterface,
      Repository repository, IMetaStore metaStore ) throws KettleException {
    try {
      // The object that we're modifying here is a copy of the original!
      // So let's change the filename from relative to absolute by grabbing the file object...
      // In case the name of the file comes from previous steps, forget about this!
      //
      if ( !filefield ) {
        for ( int i = 0; i < fileName.length; i++ ) {
          FileObject fileObject = KettleVFS.getInstance( executionBowl )
            .getFileObject( space.environmentSubstitute( fileName[i] ), space );
          fileName[i] = namingInterface.nameResource( fileObject, space, Utils.isEmpty( fileMask[i] ) );
        }
      }
      return null;
    } catch ( Exception e ) {
      throw new KettleException( e );
    }
  }

  @Override
  public StepHelperInterface getStepHelperInterface() {
    return new GetFilesRowCountHelper( this );
  }

}

View on GitHub (pinned to f3058517a1)