pentaho/pentaho-kettle · error · KettleJobException

An unexpected error has occurred

Error message

An unexpected error has occurred 

What it means

Catch-all in login()'s retry loop: any unexpected exception from tryCreateNewConnection() or surrounding code (other than InterruptedException) is rethrown as this KettleJobException with the original as cause. It signals an unforeseen failure during the connection attempt.

Solutions

  1. Inspect the wrapped cause (e.getCause()) to identify the true failure.
  2. Validate all SFTP entry fields (host, port, user, password/key) are non-null before login.
  3. Check the JSch dependency version matches what this Pentaho version expects.
  4. Reproduce with JSch logging enabled to capture the handshake failure detail.

Example fix

// before
client.login(); // NPE when password field null
// after
Objects.requireNonNull(password, "password required");
client.login();
Defensive patterns

Strategy: try-catch

Validate before calling

Objects.requireNonNull(host, "host");
Objects.requireNonNull(user, "user");
assert port > 0 : "port must be positive";

Try / catch

try {
  client.login();
} catch (KettleJobException e) {
  Throwable root = e;
  while (root.getCause() != null) root = root.getCause();
  logError("Unexpected login failure, root cause: " + root);
}

Prevention

When it happens

Trigger: login() where tryCreateNewConnection() throws any non-interrupt Exception - e.g. JSch session/auth errors surfaced as runtime exceptions, NPEs from null configuration, or unexpected state.

Common situations: Null fields in SFTP entry config causing NPEs; JSch version incompatibilities; unexpected server responses during handshake; bugs in connection setup.

Related errors


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

Appendix: source

Thrown at engine/src/main/java/org/pentaho/di/job/entries/sftp/SFTPClient.java:200

    while ( true ) {
      try {
        if ( tryCreateNewConnection( ) ) {
          break;
        }

        if ( --maxConnectionAttempts <= 0 ) {
          throw new KettleJobException( "Max connection attempts reached" );
        }
        Thread.sleep( delayBetweenEachAttempts );
        // incrementing delay by 100 milliseconds
        delayBetweenEachAttempts += 100;

      } catch ( InterruptedException ex ) {
        Thread.currentThread().interrupt();
        throw new KettleJobException( "Interrupted during a retry ", ex );
      } catch ( Exception e ) {
        throw new KettleJobException( "An unexpected error has occurred ", e );
      }
    }
  }

  private boolean tryCreateNewConnection(  ) {
    try {
      session.setPassword( this.getPassword() );
      java.util.Properties config = new java.util.Properties();
      config.put( "StrictHostKeyChecking", "no" );
      // set compression property
      // zlib, none
      String compress = getCompression();
      if ( compress != null ) {
        config.put( COMPRESSION_S2C, compress );
        config.put( COMPRESSION_C2S, compress );
      }
      config.put( "ConnectTimeout", "30000" );
      config.put( "SocketTimeout", "30000" );

View on GitHub (pinned to f3058517a1)