{"record":{"id":"1d6cac171a107595","repo":"pentaho/pentaho-kettle","slug":"salesforceinput-exception-cannotgetbiding","errorCode":"SalesforceInput.Exception.CanNotGetBiding","errorMessage":"SalesforceInput.Exception.CanNotGetBiding","messagePattern":"SalesforceInput\\.Exception\\.CanNotGetBiding","errorType":"error_code","errorClass":"KettleException","httpStatus":null,"severity":"error","filePath":"plugins/salesforce/core/src/main/java/org/pentaho/di/trans/steps/salesforce/SalesforceConnection.java","lineNumber":384,"sourceCode":"      ExceptionCode exCode = ex.getExceptionCode();\n      if ( exCode == ExceptionCode.FUNCTIONALITY_NOT_ENABLED\n        || exCode == ExceptionCode.INVALID_CLIENT || exCode == ExceptionCode.INVALID_LOGIN\n        || exCode == ExceptionCode.LOGIN_DURING_RESTRICTED_DOMAIN\n        || exCode == ExceptionCode.LOGIN_DURING_RESTRICTED_TIME || exCode == ExceptionCode.ORG_LOCKED\n        || exCode == ExceptionCode.PASSWORD_LOCKOUT || exCode == ExceptionCode.SERVER_UNAVAILABLE\n        || exCode == ExceptionCode.TRIAL_EXPIRED || exCode == ExceptionCode.UNSUPPORTED_CLIENT ) {\n        throw new KettleException( BaseMessages.getString( PKG, \"SalesforceInput.Error.InvalidUsernameOrPassword\" ) );\n      }\n      throw new KettleException( BaseMessages.getString( PKG, \"SalesforceInput.Error.Connection\" ), ex );\n    } catch ( Exception e ) {\n      throw new KettleException( BaseMessages.getString( PKG, \"SalesforceInput.Error.Connection\" ), e );\n    }\n  }\n\n  public void query( boolean specifyQuery ) throws KettleException {\n\n    if ( getBinding() == null ) {\n      throw new KettleException( BaseMessages.getString( PKG, \"SalesforceInput.Exception.CanNotGetBiding\" ) );\n    }\n\n    try {\n      if ( !specifyQuery ) {\n        // check if we can query this Object\n        DescribeSObjectResult describeSObjectResult = getBinding().describeSObject( getModule() );\n        if ( describeSObjectResult == null ) {\n          throw new KettleException( BaseMessages.getString( PKG, \"SalesforceInput.ErrorGettingObject\" ) );\n        }\n        if ( !describeSObjectResult.isQueryable() ) {\n          throw new KettleException( BaseMessages.getString(\n            PKG, \"SalesforceInputDialog.ObjectNotQueryable\", module ) );\n        }\n        if ( this.recordsFilter == SalesforceConnectionUtils.RECORDS_FILTER_UPDATED\n          || this.recordsFilter == SalesforceConnectionUtils.RECORDS_FILTER_DELETED ) {\n          // The object must be replicateable\n          if ( !describeSObjectResult.isReplicateable() ) {\n            throw new KettleException( BaseMessages.getString(","sourceCodeStart":366,"sourceCodeEnd":402,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/plugins/salesforce/core/src/main/java/org/pentaho/di/trans/steps/salesforce/SalesforceConnection.java#L366-L402","documentation":"query() throws this KettleException when getBinding() returns null, meaning the connection has not been established (or was reset) before querying. The SOAP binding stub is the session handle to Salesforce; without it no query can be issued.","triggerScenarios":"Calling query() without a prior successful connect(); connect() failed earlier but the error was swallowed; the binding was never initialized because getConnection() was skipped.","commonSituations":"Custom Java code (or a step variant) calling query() directly without connect(); session invalidated by the server long-running job without reconnect logic; typo in initialization order.","solutions":["Call connect() (or getConnection()) before query() and check it succeeds.","Wrap the connect+query sequence so a failed connect aborts instead of proceeding to query.","Add reconnection logic that re-establishes the binding when the session expires.","Log the connection state before querying to catch initialization-order bugs early."],"exampleFix":"// before\nSalesforceConnection conn = new SalesforceConnection(log, url, user, pass);\nconn.query(false); // binding never created\n// after\nconn.connect();\nconn.query(false);","handlingStrategy":"validation","validationCode":"if (conn.getBinding() == null) {\n  conn.connect(); // establish session before querying\n}","typeGuard":null,"tryCatchPattern":"try {\n  conn.query(specifyQuery);\n} catch (KettleException e) {\n  if (e.getMessage().contains(\"CanNotGetBiding\")) {\n    conn.connect();\n    conn.query(specifyQuery); // one reconnect retry\n  } else { throw e; }\n}","preventionTips":["Enforce connect-before-query in wrapper code.","Add session-expiry reconnect logic for long jobs.","Fail fast when connect() throws instead of continuing."],"tags":["salesforce","state","invalid-state-transition","kettle"],"backgroundTag":"invalid-state-transition","analyzedSha":"f3058517a153da500bf4551f46d79b91bf8ec552","analyzedAt":"2026-09-13T14:04:16.340Z","contentChangedAt":"2026-09-13T14:04:16.340Z","schemaVersion":2},"datasetVersion":"2026-09-20T23:17:15.980Z"}