pentaho/pentaho-kettle · error · KettleException

SalesforceInsert.Error

Error message

SalesforceInsert.Error

What it means

writeToSalesForce() buffers rows and, when the buffer is full (or in flush mode), flushes them to Salesforce. Any Exception raised in that path (including from flushBuffers()) is rethrown as KettleException 'Error' with e.getMessage(). It is a wrapper — the true failure is in the nested cause/flushBuffers error.

Solutions

  1. Look at the nested message/cause for the actual Salesforce error (often a 'SalesforceInsert.Error.FlushBuffer' detail)
  2. Validate that mapped field values conform to the Salesforce object's field types/lengths
  3. Reduce meta.getBatchSizeInt() to isolate which row/record fails
  4. Enable error handling on the step to route failed rows to an error stream
Defensive patterns

Strategy: retry

Validate before calling

for (Object[] row : pendingRows) {
  Object val = row[fieldIndex];
  if (val == null && requiredField) throw new IllegalArgumentException("Required value missing");
  if (val instanceof String && ((String) val).length() > maxLen) throw new IllegalArgumentException("Value too long");
}

Try / catch

try {
  writeToSalesForce(row);
} catch (KettleException e) {
  if (isTransient(e)) retryWithBackoff(row);
  else log.error("Non-retryable Salesforce batch error: {}", e.getMessage(), e);
}

Prevention

When it happens

Trigger: Buffer flush fails while writing a row: SOAP create/update call throws, network error, or flushBuffers() throws 'Error.FlushBuffer' for a failed save result. Raised both at runtime (via processRow) and in unit tests invoking writeToSalesForce directly.

Common situations: Salesforce batch insert fails due to invalid field values; session/timeout during a large batch; Salesforce API errors surfacing through the nested flushBuffers exception.

Related errors


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

Appendix: source

Thrown at plugins/salesforce/core/src/main/java/org/pentaho/di/trans/steps/salesforceinsert/SalesforceInsert.java:169

        if ( fieldsToNull.size() > 0 ) {
          // Set Null to fields
          sobjPass.setFieldsToNull( fieldsToNull.toArray( new String[fieldsToNull.size()] ) );
        }

        // Load the buffer array
        data.sfBuffer[data.iBufferPos] = sobjPass;
        data.outputBuffer[data.iBufferPos] = rowData;
        data.iBufferPos++;
      }

      if ( data.iBufferPos >= meta.getBatchSizeInt() ) {
        if ( log.isDetailed() ) {
          logDetailed( BaseMessages.getString( PKG, "SalesforceInsert.CallingFlushBuffer" ) );
        }
        flushBuffers();
      }
    } catch ( Exception e ) {
      throw new KettleException( BaseMessages.getString( PKG, "SalesforceInsert.Error", e.getMessage() ) );
    }
  }

  private void flushBuffers() throws KettleException {
    try {
      // create the object(s) by sending the array to the web service
      data.saveResult = data.connection.insert( data.sfBuffer );
      for ( int j = 0; j < data.saveResult.length; j++ ) {
        if ( data.saveResult[j].isSuccess() ) {
          // Row was inserted
          String id = data.saveResult[j].getId();
          if ( log.isDebug() ) {
            logDebug( BaseMessages.getString( PKG, "SalesforceInsert.RowInserted", id ) );
          }

          // write out the row with the SalesForce ID
          Object[] newRow = RowDataUtil.resizeArray( data.outputBuffer[j], data.outputRowMeta.size() );

View on GitHub (pinned to f3058517a1)