pentaho/pentaho-kettle · error · KettleRepositoryLostException

Session recovery failed or was canceled

Error message

Session recovery failed or was canceled

What it means

RepositorySessionTimeoutHandler.handleSessionExpiry clears the repository from Spoon (setRepository(null)) and throws KettleRepositoryLostException('Session recovery failed or was canceled') when automatic session recovery could not be completed or the user declined the recovery prompt. After this, the current repository connection is gone and the operation that hit the expiry cannot proceed.

Solutions

  1. Reconnect to the repository manually (Connect dialog) and redo the operation
  2. Check credentials/server availability if re-login attempts fail repeatedly
  3. Increase the server session timeout to reduce frequency of expiry
  4. Save work frequently so a session loss does not lose changes

Example fix

// before
repository.someOp(); // throws KettleRepositoryLostException on unrecoverable expiry
// after
try {
  repository.someOp();
} catch ( KettleRepositoryLostException e ) {
  promptUserToReconnect(); // guide user through manual reconnect
}
Defensive patterns

Strategy: try-catch

Validate before calling

// detect lost-session style failures before deep stacks
boolean isRepositoryLost( Throwable t ) {
  while ( t != null ) {
    if ( t instanceof KettleRepositoryLostException ) return true;
    t = t.getCause();
  }
  return false;
}

Type guard

boolean isRepositoryLost( Throwable t ) {
  while ( t != null ) {
    if ( t instanceof KettleRepositoryLostException ) return true;
    t = t.getCause();
  }
  return false;
}

Try / catch

try {
  repository.someOp();
} catch ( KettleRepositoryLostException e ) {
  // repository is disconnected; guide user to reconnect, do not retry blindly
  spoon.promptRepositoryConnect();
}

Prevention

When it happens

Trigger: A repository invocation fails with a session-timeout/lost-session error; the handler tries to recover (re-login) but recovery fails, is not possible, or the user cancels the recovery dialog.

Common situations: Long-running Spoon session whose Pentaho server session timed out; user dismisses the re-login dialog; re-login attempts fail due to wrong credentials or server unavailability.

Related errors


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

Appendix: source

Thrown at plugins/repositories/core/src/main/java/org/pentaho/di/ui/repo/timeout/RepositorySessionTimeoutHandler.java:120

    Spoon spoon = Spoon.getInstance();

    sessionTimeoutHandler.getRepositoryConnectController().setRelogin( true );

    disconnectRepository( spoon );

    // Show login dialog - browser auth will be selected automatically if previously used
    boolean loginSuccessful = sessionTimeoutHandler.showLoginScreen( sessionTimeoutHandler.getRepositoryConnectController() );

    if ( loginSuccessful && spoon.getRepository() != null && spoon.getRepository().isConnected() ) {
      return reconnectAndRetry( method, args );
    }
    // Must run on the UI thread since setRepository may trigger UI updates (tree refresh, tab changes)
    if ( spoon.getDisplay() != null ) {
      spoon.getDisplay().syncExec( () -> spoon.setRepository( null ) );
    } else {
      spoon.setRepository( null );
    }
    throw new KettleRepositoryLostException( "Session recovery failed or was canceled" );
  }

  private void disconnectRepository( Spoon spoon ) {
    if ( spoon.getRepository() != null ) {
      try {
        spoon.getRepository().disconnect();
      } catch ( Exception e ) {
        // Ignore errors during emergency disconnect
      }
    }
  }

  private Object reconnectAndRetry( Method method, Object[] args )
      throws SessionRecoveryRetryException {
    try {
      ConnectionManager.getInstance().reset();
    } catch ( Exception ce ) {
      // Intentionally ignore cache reset errors - they should not prevent reconnection

View on GitHub (pinned to f3058517a1)