{"record":{"id":"456eaa53a127a5a1","repo":"pentaho/pentaho-kettle","slug":"salesforceupdate-error-flushbuffer","errorCode":null,"errorMessage":"SalesforceUpdate.Error.FlushBuffer","messagePattern":"SalesforceUpdate\\.Error\\.FlushBuffer","errorType":"exception","errorClass":"KettleException","httpStatus":null,"severity":"error","filePath":"plugins/salesforce/core/src/main/java/org/pentaho/di/trans/steps/salesforceupdate/SalesforceUpdate.java","lineNumber":218,"sourceCode":"            if ( log.isDetailed() ) {\n              logDetailed( BaseMessages.getString( PKG, \"SalesforceUpdate.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( \"Found error from SalesForce and raising the exception\" );\n            }\n\n            // Only send the first error\n            //\n            com.sforce.soap.partner.Error err = data.saveResult[j].getErrors()[0];\n            throw new KettleException( BaseMessages.getString( PKG, \"SalesforceUpdate.Error.FlushBuffer\", new Integer(\n                j ), err.getStatusCode(), err.getMessage() ) );\n          }\n\n          String errorMessage = \"\";\n          for ( int i = 0; i < data.saveResult[j].getErrors().length; i++ ) {\n            // get the next error\n            com.sforce.soap.partner.Error err = data.saveResult[j].getErrors()[i];\n            errorMessage +=\n                BaseMessages.getString( PKG, \"SalesforceUpdate.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( \"Passing row to error step\" );\n          }\n\n          putError( getInputRowMeta(), data.outputBuffer[j], 1, errorMessage, null, \"SalesforceUpdate001\" );","sourceCodeStart":200,"sourceCodeEnd":236,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/plugins/salesforce/core/src/main/java/org/pentaho/di/trans/steps/salesforceupdate/SalesforceUpdate.java#L200-L236","documentation":"In SalesforceUpdate.flushBuffers(), after calling Salesforce update() the step inspects each SaveResult. If a result reports failure and the step is not in error-handling mode, it throws a KettleException keyed 'SalesforceUpdate.Error.FlushBuffer' with the row index, the first error's StatusCode, and its message. This is Salesforce rejecting one or more records in the committed batch.","triggerScenarios":"data.saveResult[j].getSuccess() is false: Salesforce rejected record j of the batch — e.g. invalid field value, missing required field, record locked, INVALID_FIELD / MALFORMED_ID status codes returned by the partner API.","commonSituations":"Updating a record with an invalid Id format; writing a value that violates a Salesforce validation rule; insufficient field-level security; updating a required field with null.","solutions":["Read the StatusCode and message embedded in the exception — it names the exact Salesforce field and problem.","Fix the offending data in the stream (bad Id, null on a required field, value failing a validation rule).","Enable step error handling to route failed records to an error stream instead of aborting the batch.","Check field-level security/permissions on the Salesforce object for the integration user."],"exampleFix":"// before: invalid 15/18-char Id passed in the stream\nrow[0] = \"12345\"; // not a valid Salesforce Id\n// after: use a full record Id fetched from Salesforce\nrow[0] = \"001XXXXXXXXXXXXXXX\";","handlingStrategy":"try-catch","validationCode":"// Validate Salesforce Id format before sending\nif (idField != null && !idField.matches(\"^[a-zA-Z0-9]{15}(?:[a-zA-Z0-9]{3})?$\")) {\n  throw new IllegalArgumentException(\"Invalid Salesforce Id: \" + idField);\n}","typeGuard":null,"tryCatchPattern":"try {\n  trans.execute(null);\n} catch (KettleException e) {\n  // 'SalesforceUpdate.Error.FlushBuffer ... <rowIndex> <StatusCode> <message>'\n  // route failed rows to an error stream by enabling error handling on the step\n  log.error(\"Salesforce rejected record: {}\", e.getMessage());\n}","preventionTips":["Pre-validate record Ids and required fields in the stream before updating.","Enable step error handling so one bad record doesn't abort the batch.","Check Salesforce validation rules and field-level security for the integration user.","Keep external-ID field settings consistent with the actual schema."],"tags":["salesforce","api","batch-write","validation"],"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"}