{"record":{"id":"71c04bc11844cd69","repo":"pentaho/pentaho-kettle","slug":"salesforceupsert-error-flushbuffer","errorCode":null,"errorMessage":"SalesforceUpsert.Error.FlushBuffer","messagePattern":"SalesforceUpsert\\.Error\\.FlushBuffer","errorType":"exception","errorClass":"KettleException","httpStatus":null,"severity":"error","filePath":"plugins/salesforce/core/src/main/java/org/pentaho/di/trans/steps/salesforceupsert/SalesforceUpsert.java","lineNumber":255,"sourceCode":"            if ( log.isDetailed() ) {\n              logDetailed( BaseMessages.getString( PKG, \"SalesforceUpsert.log.LineRow\", \"\" + getLinesInput() ) );\n            }\n          }\n\n        } else {\n          // there were errors during the create call, go through the\n          // errors\n          // array and write them to the screen\n\n          if ( !getStepMeta().isDoingErrorHandling() ) {\n            if ( log.isDetailed() ) {\n              logDetailed( BaseMessages.getString( PKG, \"SalesforceUpsert.ErrorFound\" ) );\n            }\n\n            // Only throw the first error\n            //\n            com.sforce.soap.partner.Error err = data.upsertResult[j].getErrors()[0];\n            throw new KettleException( BaseMessages\n              .getString( PKG, \"SalesforceUpsert.Error.FlushBuffer\", new Integer( j ), err.getStatusCode(), err\n                .getMessage() ) );\n          }\n\n          String errorMessage = \"\";\n          for ( int i = 0; i < data.upsertResult[j].getErrors().length; i++ ) {\n            // get the next error\n            com.sforce.soap.partner.Error err = data.upsertResult[j].getErrors()[i];\n            errorMessage +=\n              BaseMessages.getString( PKG, \"SalesforceUpsert.Error.FlushBuffer\", new Integer( j ), err\n                .getStatusCode(), err.getMessage() );\n          }\n\n          // Simply add this row to the error row\n          if ( log.isDebug() ) {\n            logDebug( BaseMessages.getString( PKG, \"SalesforceUpsert.PassingRowToErrorStep\" ) );\n          }\n          putError( getInputRowMeta(), data.outputBuffer[j], 1, errorMessage, null, \"SalesforceUpsert001\" );","sourceCodeStart":237,"sourceCodeEnd":273,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/plugins/salesforce/core/src/main/java/org/pentaho/di/trans/steps/salesforceupsert/SalesforceUpsert.java#L237-L273","documentation":"Thrown in SalesforceUpsert.flushBuffers when Salesforce returns an upsertResult whose success flag is false: the first error's status code and message (plus the row index j) are formatted into this KettleException. It surfaces a record-level Salesforce rejection, e.g. a field-level validation or invalid external ID.","triggerScenarios":"An upsert call completes but data.upsertResult[j].getSuccess() is false for record j — Salesforce rejected the record. Thrown only when detailed logging shows errors are found; the first error of the batch is raised.","commonSituations":"INVALID_FIELD errors from wrong external-ID field; required Salesforce fields missing from the mapping; validation rules failing; duplicate/malformed external-ID values; insufficient object permissions in Salesforce.","solutions":["Read the status code (e.g. INVALID_FIELD, MALFORMED_ID, REQUIRED_FIELD_MISSING) and message in the exception to identify the failing row.","Fix the field mapping or data that violates the Salesforce status code reported.","Verify the external-ID field name and that it's marked as external ID in Salesforce.","Enable step error handling so rejected records go to an error stream instead of failing the whole transformation."],"exampleFix":"// before: mapping a non-existent field\n<lookup>Account_Ext_Id__c</lookup> // field deleted in Salesforce\n// after: recreate or remap\n<lookup>Account_External_Id__c</lookup>","handlingStrategy":"try-catch","validationCode":"// pre-validate mapped fields exist on the Salesforce object\nconnectionManager.describeSObject(objectName); // check each updateLookup field against describe results","typeGuard":null,"tryCatchPattern":"try { writeToSalesForce(rowData); } catch (KettleException e) { if (e.getMessage().contains(\"FlushBuffer\")) { parseStatusCode(e.getMessage()); routeRowToErrorStream(rowData, e); } else throw e; }","preventionTips":["Verify external-ID fields exist and are flagged external ID in Salesforce","Map all required Salesforce fields","Check object-level permissions for the integration user","Enable error handling to isolate rejected records"],"tags":["pentaho","kettle","salesforce","upsert","record-level-error"],"backgroundTag":"api-error-response","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"}