pentaho/pentaho-kettle · warning · InvocationTargetException

This operation was cancelled!

Error message

This operation was cancelled!

What it means

GetQueryFieldsProgressDialog executes the user's SQL and derives the result fields via db.getQueryFields(). After the query completes, if the progress monitor reports cancellation, it deliberately throws an InvocationTargetException wrapping 'This operation was cancelled!' so the dialog reports the operation as aborted rather than returning partial field metadata.

Solutions

  1. This is expected behaviour when the user cancels: handle the InvocationTargetException and treat the cancellation as a normal outcome, not a failure.
  2. If cancellation appears without a user action, check for a stuck/shared IProgressMonitor that was cancelled by a previous operation.
  3. Avoid re-running heavy getQueryFields calls on huge SQL; limit the SQL statement so it returns quickly.

Example fix

// before
try {
  new GetQueryFieldsProgressDialog( shell, loggingObject, dbMeta, sql ).open();
} catch ( Exception e ) {
  e.printStackTrace();
}
// after
try {
  new GetQueryFieldsProgressDialog( shell, loggingObject, dbMeta, sql ).open();
} catch ( InvocationTargetException ite ) {
  if ( !( ite.getCause() != null && ite.getCause().getMessage().contains( "cancelled" ) ) ) {
    logError( "Query fields lookup failed", ite );
  }
}
Defensive patterns

Strategy: try-catch

Try / catch

try {
  new GetQueryFieldsProgressDialog( shell, loggingObject, dbMeta, sql ).open();
} catch ( InvocationTargetException e ) {
  if ( e.getCause() != null && "This operation was cancelled!".equals( e.getCause().getMessage() ) ) {
    return; // user cancelled; not an error
  }
  logError( "Get fields failed", e );
}

Prevention

When it happens

Trigger: Clicking Cancel in the progress dialog while 'get query fields' is running; the monitor.isCanceled() check becomes true after getQueryFields returns (or during it).

Common situations: Users cancelling a long-running SQL statement in the SQL editor's field-lookup; slow queries against large tables where the user gives up and cancels.

Related errors


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

Appendix: source

Thrown at ui/src/main/java/org/pentaho/di/ui/core/database/dialog/GetQueryFieldsProgressDialog.java:65

  /**
   * Creates a new dialog that will handle the wait while we're finding out what tables, views etc we can reach in the
   * database.
   */
  public GetQueryFieldsProgressDialog( Shell shell, DatabaseMeta dbInfo, String sql ) {
    this.shell = shell;
    this.dbMeta = dbInfo;
    this.sql = sql;
  }

  public RowMetaInterface open() {
    IRunnableWithProgress op = new IRunnableWithProgress() {
      public void run( IProgressMonitor monitor ) throws InvocationTargetException, InterruptedException {
        db = new Database( Spoon.loggingObject, dbMeta );
        try {
          db.connect();
          result = db.getQueryFields( sql, false );
          if ( monitor.isCanceled() ) {
            throw new InvocationTargetException( new Exception( "This operation was cancelled!" ) );
          }
        } catch ( Exception e ) {
          throw new InvocationTargetException( e, "Problem encountered determining query fields: " + e.toString() );
        } finally {
          db.close();
        }
      }
    };

    try {
      final ProgressMonitorDialog pmd = new ProgressMonitorDialog( shell );

      // Run something in the background to cancel active database queries, forecably if needed!
      Runnable run = new Runnable() {
        public void run() {
          IProgressMonitor monitor = pmd.getProgressMonitor();
          while ( pmd.getShell() == null || ( !pmd.getShell().isDisposed() && !monitor.isCanceled() ) ) {
            try {

View on GitHub (pinned to f3058517a1)