{"record":{"id":"398f230a61926c96","repo":"pentaho/pentaho-kettle","slug":"salesforceinsert-log-exception","errorCode":null,"errorMessage":"SalesforceInsert.log.Exception","messagePattern":"SalesforceInsert\\.log\\.Exception","errorType":"exception","errorClass":"KettleStepException","httpStatus":null,"severity":"error","filePath":"plugins/salesforce/core/src/main/java/org/pentaho/di/trans/steps/salesforceinsert/SalesforceInsert.java","lineNumber":105,"sourceCode":"      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, \"SalesforceInsert.CanNotFindField\", meta\n            .getUpdateStream()[i] ) );\n        }\n      }\n    }\n\n    try {\n      writeToSalesForce( outputRowData );\n\n    } catch ( Exception e ) {\n      throw new KettleStepException( BaseMessages.getString( PKG, \"SalesforceInsert.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, \"SalesforceInsert.WriteToSalesforce\", data.iBufferPos, meta\n          .getBatchSizeInt() ) );\n      }\n\n      // if there is room in the buffer\n      if ( data.iBufferPos < meta.getBatchSizeInt() ) {\n        ArrayList<XmlObject> insertfields = new ArrayList<>();\n        // Reserve for empty fields\n        ArrayList<String> fieldsToNull = new ArrayList<String>();","sourceCodeStart":87,"sourceCodeEnd":123,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/plugins/salesforce/core/src/main/java/org/pentaho/di/trans/steps/salesforceinsert/SalesforceInsert.java#L87-L123","documentation":"processRow() calls writeToSalesForce(outputRowData) and wraps any Exception it throws into a KettleStepException with the 'log.Exception' message. This is a generic wrapper: the real problem (SOAP call failure, data conversion, buffer issue) is in the cause, and note the message swallows the stack trace since the cause is only interpolated into the text.","triggerScenarios":"Any Exception from writeToSalesForce() during processRow: Salesforce SOAP call fails, SObject construction fails on the row data, or connection to the Salesforce API breaks.","commonSituations":"Salesforce API outage or session expiry mid-transformation; invalid field value for the SObject type; network failure; batch write raising an unexpected exception type.","solutions":["Inspect writeToSalesForce's wrapped cause / log the full stack — enable detailed logging to see the underlying error","Verify Salesforce connection (username/password/security token, endpoint URL) is still valid","Handle error rows (step error handling) so bad rows are routed instead of killing the transformation","Improve diagnostics: pass 'e' as cause instead of embedding via message interpolation"],"exampleFix":"// before\nthrow new KettleStepException(BaseMessages.getString(PKG, \"SalesforceInsert.log.Exception\", e));\n// after\nthrow new KettleStepException(BaseMessages.getString(PKG, \"SalesforceInsert.log.Exception\", e.getMessage()), e);","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n  trans.execute(null);\n  trans.waitUntilFinished();\n} catch (KettleException e) {\n  Throwable root = e;\n  while (root.getCause() != null) root = root.getCause();\n  log.error(\"SalesforceInsert write failed, root cause: {}\", root.getMessage(), root);\n}","preventionTips":["Validate Salesforce credentials/tokens are fresh before long-running transformations","Set up step error handling to capture failing rows rather than aborting","Unwrap and log full cause chains to diagnose the real SOAP failure"],"tags":["kettle","salesforce","soap","wrapped-exception"],"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"}