{"record":{"id":"f44a8606c26cac7b","repo":"pentaho/pentaho-kettle","slug":"salesforceupsert-log-exception","errorCode":null,"errorMessage":"SalesforceUpsert.log.Exception","messagePattern":"SalesforceUpsert\\.log\\.Exception","errorType":"exception","errorClass":"KettleStepException","httpStatus":null,"severity":"error","filePath":"plugins/salesforce/core/src/main/java/org/pentaho/di/trans/steps/salesforceupsert/SalesforceUpsert.java","lineNumber":113,"sourceCode":"      data.outputRowMeta = data.inputRowMeta.clone();\n      meta.getFields( getTransMeta().getBowl(), data.outputRowMeta, getStepname(), null, null, this, repository,\n                      metaStore );\n\n      // Build the mapping of input position to field name\n      data.fieldnrs = new int[meta.getUpdateStream().length];\n      for ( int i = 0; i < meta.getUpdateStream().length; i++ ) {\n        data.fieldnrs[i] = getInputRowMeta().indexOfValue( meta.getUpdateStream()[i] );\n        if ( data.fieldnrs[i] < 0 ) {\n          throw new KettleException( BaseMessages.getString( PKG, \"SalesforceUpsert.FieldNotFound\", meta\n            .getUpdateStream()[i] ) );\n        }\n      }\n    }\n\n    try {\n      writeToSalesForce( outputRowData );\n    } catch ( Exception e ) {\n      throw new KettleStepException( BaseMessages.getString( PKG, \"SalesforceUpsert.log.Exception\" ), e );\n    }\n    return true;\n  }\n\n  @VisibleForTesting\n  void writeToSalesForce( Object[] rowData ) throws KettleException {\n    try {\n\n      if ( log.isDetailed() ) {\n        logDetailed( BaseMessages.getString( PKG, \"SalesforceUpsert.CalledWrite\", data.iBufferPos, meta\n          .getBatchSizeInt() ) );\n      }\n      // if there is room in the buffer\n      if ( data.iBufferPos < meta.getBatchSizeInt() ) {\n        // Reserve for empty fields\n        ArrayList<String> fieldsToNull = new ArrayList<String>();\n        ArrayList<XmlObject> upsertfields = new ArrayList<>();\n","sourceCodeStart":95,"sourceCodeEnd":131,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/plugins/salesforce/core/src/main/java/org/pentaho/di/trans/steps/salesforceupsert/SalesforceUpsert.java#L95-L131","documentation":"Generic wrapper in SalesforceUpsert.processRow: any exception thrown by writeToSalesForce is caught and rethrown as a KettleStepException with this message and the original cause attached. It marks the step as failed for the current row batch; the specific root cause is in the chained exception.","triggerScenarios":"writeToSalesForce throws — Salesforce login/API failure, connection problems, SOAP marshalling errors, or a KettleException raised inside buffer flushing during processRow.","commonSituations":"Expired Salesforce session mid-run; network outage during upsert; invalid SObject data causing the WS client to fail; Salesforce API maintenance window.","solutions":["Inspect the chained cause (e.getCause()) for the actual Salesforce/transport error.","Verify Salesforce connectivity, credentials, and that the API endpoint is reachable.","Re-run the transformation after any transient network/Salesforce outage.","If data-driven, fix the offending records and enable error handling on the step to route bad rows instead of failing."],"exampleFix":"// before\n// step fails on first transient Salesforce hiccup\n// after: configure retry / error handling\nstepMeta.setDoingErrorHandling(true); // route failed rows to an error stream and retry transient failures","handlingStrategy":"retry","validationCode":"// verify Salesforce session before running\nif (!connectionManager.verifyConnection()) { connectionManager.renewSession(); }","typeGuard":null,"tryCatchPattern":"try { writeToSalesForce(rowData); } catch (KettleStepException e) { Throwable root = e; while (root.getCause() != null) root = root.getCause(); log.error(\"Salesforce write failed: \" + root.getMessage()); if (isTransient(root)) retry(rowData, 3); else throw e; }","preventionTips":["Monitor Salesforce API availability before large runs","Keep sessions refreshed for long transformations","Inspect the chained cause rather than the wrapper message"],"tags":["pentaho","kettle","salesforce","wrapper-exception","api"],"backgroundTag":"api-request-failed","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"}