pentaho/pentaho-kettle · error · KettleException

SalesforceConnection.Exception.Query

Error message

SalesforceConnection.Exception.Query

What it means

KettleException wrapping any failure from SalesforceConnection.query(), which executes a SOQL query via the Salesforce SOAP partner binding and loads result records. The original exception is logged with a stack tracker and rethrown with the message key 'SalesforceConnection.Exception.Query'. It means the SOQL query or result retrieval failed at the Salesforce API level.

Solutions

  1. Print the cause (KettleException.getCause()) — SalesforceFault messages name the exact invalid field/object in the SOQL
  2. Validate the SOQL in the Salesforce Developer Console / Workbench before running the transformation
  3. Re-connect (reconnect()/connect) if the session expired, and check username/password/security-token settings
  4. Verify field-level security permissions for the integration user on all queried fields
  5. Check network/proxy connectivity to the Salesforce endpoint

Example fix

// before
connection.query("SELECT Id, Nam FROM Account");
// after
connection.query("SELECT Id, Name FROM Account"); // fix typo; also wrap in try-catch and log getCause()
Defensive patterns

Strategy: try-catch

Validate before calling

if (soql == null || soql.trim().isEmpty() || !soql.trim().toLowerCase().startsWith("select")) throw new IllegalArgumentException("Invalid SOQL: " + soql);

Type guard

boolean isExecutable(Connection c) { try { return c != null && c.getConnection() != null; } catch (Exception e) { return false; } }

Try / catch

try { connection.query(soql); } catch (KettleException e) { log.logError("SOQL failed: " + e.getCause(), e); /* check session, fix SOQL, retry once */ }

Prevention

When it happens

Trigger: Calling query() with invalid SOQL, an object/field name that does not exist, expired or invalid Salesforce session binding, or a network failure while fetching QueryResult batches.

Common situations: Typo'd field names in the step's SOQL, querying objects with restricted field-level security, session timeout on long-running transformations, Salesforce outage or API deprecation of queried fields.

Related errors


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

Appendix: source

Thrown at plugins/salesforce/core/src/main/java/org/pentaho/di/trans/steps/salesforce/SalesforceConnection.java:486

            this.sObjects = getQueryResult().getRecords();
            this.queryResultSize = getQueryResult().getSize();
          }
          break;
        default:
          // return query result
          this.qr = isQueryAll() ? getBinding().queryAll( getSQL() ) : getBinding().query( getSQL() );
          this.sObjects = getQueryResult().getRecords();
          this.queryResultSize = getQueryResult().getSize();
          break;
      }
      if ( this.sObjects != null ) {
        this.recordsCount = this.sObjects.length;
      } else {
        this.recordsCount = 0;
      }
    } catch ( Exception e ) {
      log.logError( Const.getStackTracker( e ) );
      throw new KettleException( BaseMessages.getString( PKG, "SalesforceConnection.Exception.Query" ), e );
    }
  }

  public void close() throws KettleException {
    try {
      if ( !getQueryResult().isDone() ) {
        this.qr.setDone( true );
        this.qr = null;
      }
      if ( this.sObjects != null ) {
        this.sObjects = null;
      }
      if ( this.binding != null ) {
        this.binding = null;
      }
      if ( this.loginResult != null ) {
        this.loginResult = null;
      }

View on GitHub (pinned to f3058517a1)