pentaho/pentaho-kettle · error · KettleException

SalesforceInsert.Error.FlushBuffer

Error message

SalesforceInsert.Error.FlushBuffer

What it means

flushBuffers() sends the buffered SObjects to Salesforce and inspects each SaveResult. If a SaveResult reports success=false, the step reads the first com.sforce.soap.partner.Error and throws KettleException 'Error.FlushBuffer' including the row index (j), the status code, and the Salesforce error message. It is raised only when error handling is not enabled for the failing record path (first-error-only behavior).

Solutions

  1. Read the status code/message in the error text — it is the actual Salesforce API rejection reason
  2. Fix the offending data (required fields, picklist values, duplicates) before re-running
  3. Configure step error handling so failed records go to an error stream instead of stopping the transformation
  4. Log all errors per record instead of only the first (the code truncates to getErrors()[0])

Example fix

// before
com.sforce.soap.partner.Error err = data.saveResult[j].getErrors()[0];
// after (log all errors)
for (com.sforce.soap.partner.Error err : data.saveResult[j].getErrors()) {
  logError(err.getStatusCode() + ": " + err.getMessage());
}
Defensive patterns

Strategy: validation

Validate before calling

// Validate required Salesforce fields exist and picklist values are legal before insert
if (sobject.getField("Name") == null) {
  throw new IllegalArgumentException("REQUIRED_FIELD_MISSING: Name");
}

Try / catch

try {
  trans.execute(null);
} catch (KettleException e) {
  // message embeds row index + status code, e.g. REQUIRED_FIELD_MISSING
  log.error("Salesforce rejected record: {}", e.getMessage(), e);
}
// Better: attach an error-handling step so failures route to an error stream

Prevention

When it happens

Trigger: Salesforce rejects a record in the batch: e.g. INVALID_FIELD, REQUIRED_FIELD_MISSING, DUPLICATES_DETECTED, malformed external id, or record locked. Any saveResult[j].getSuccess()==false triggers this with the first error only.

Common situations: Inserting records missing required Salesforce fields; invalid picklist values; hitting validation rules; duplicate rules blocking inserts; permission issues on the object.

Related errors


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

Appendix: source

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

              logDetailed( BaseMessages.getString( PKG, "SalesforceInsert.log.LineRow", getLinesInput() ) );
            }
          }

        } else {
          // there were errors during the create call, go through the
          // errors
          // array and write them to the screen

          if ( !getStepMeta().isDoingErrorHandling() ) {

            if ( log.isDebug() ) {
              logDebug( BaseMessages.getString( PKG, "SalesforceInsert.ErrorFound" ) );
            }

            // Only show the first error
            //
            com.sforce.soap.partner.Error err = data.saveResult[j].getErrors()[0];
            throw new KettleException( BaseMessages
              .getString( PKG, "SalesforceInsert.Error.FlushBuffer", new Integer( j ), err.getStatusCode(), err
                .getMessage() ) );
          }

          String errorMessage = "";
          for ( int i = 0; i < data.saveResult[j].getErrors().length; i++ ) {
            // get the next error
            com.sforce.soap.partner.Error err = data.saveResult[j].getErrors()[i];
            errorMessage +=
              BaseMessages.getString( PKG, "SalesforceInsert.Error.FlushBuffer", new Integer( j ), err
                .getStatusCode(), err.getMessage() );
          }

          // Simply add this row to the error row
          if ( log.isDetailed() ) {
            logDetailed( BaseMessages.getString( PKG, "SalesforceInsert.PassingRowToErrorStep" ) );
          }
          putError( getInputRowMeta(), data.outputBuffer[j], 1, errorMessage, null, "SalesforceInsert001" );

View on GitHub (pinned to f3058517a1)