{"record":{"id":"bb1fdf1fabda1779","repo":"pentaho/pentaho-kettle","slug":"salesforceinsert-error","errorCode":null,"errorMessage":"SalesforceInsert.Error","messagePattern":"SalesforceInsert\\.Error","errorType":"exception","errorClass":"KettleException","httpStatus":null,"severity":"error","filePath":"plugins/salesforce/core/src/main/java/org/pentaho/di/trans/steps/salesforceinsert/SalesforceInsert.java","lineNumber":169,"sourceCode":"        if ( fieldsToNull.size() > 0 ) {\n          // Set Null to fields\n          sobjPass.setFieldsToNull( fieldsToNull.toArray( new String[fieldsToNull.size()] ) );\n        }\n\n        // Load the buffer array\n        data.sfBuffer[data.iBufferPos] = sobjPass;\n        data.outputBuffer[data.iBufferPos] = rowData;\n        data.iBufferPos++;\n      }\n\n      if ( data.iBufferPos >= meta.getBatchSizeInt() ) {\n        if ( log.isDetailed() ) {\n          logDetailed( BaseMessages.getString( PKG, \"SalesforceInsert.CallingFlushBuffer\" ) );\n        }\n        flushBuffers();\n      }\n    } catch ( Exception e ) {\n      throw new KettleException( BaseMessages.getString( PKG, \"SalesforceInsert.Error\", e.getMessage() ) );\n    }\n  }\n\n  private void flushBuffers() throws KettleException {\n    try {\n      // create the object(s) by sending the array to the web service\n      data.saveResult = data.connection.insert( data.sfBuffer );\n      for ( int j = 0; j < data.saveResult.length; j++ ) {\n        if ( data.saveResult[j].isSuccess() ) {\n          // Row was inserted\n          String id = data.saveResult[j].getId();\n          if ( log.isDebug() ) {\n            logDebug( BaseMessages.getString( PKG, \"SalesforceInsert.RowInserted\", id ) );\n          }\n\n          // write out the row with the SalesForce ID\n          Object[] newRow = RowDataUtil.resizeArray( data.outputBuffer[j], data.outputRowMeta.size() );\n","sourceCodeStart":151,"sourceCodeEnd":187,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/plugins/salesforce/core/src/main/java/org/pentaho/di/trans/steps/salesforceinsert/SalesforceInsert.java#L151-L187","documentation":"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.","triggerScenarios":"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.","commonSituations":"Salesforce batch insert fails due to invalid field values; session/timeout during a large batch; Salesforce API errors surfacing through the nested flushBuffers exception.","solutions":["Look at the nested message/cause for the actual Salesforce error (often a 'SalesforceInsert.Error.FlushBuffer' detail)","Validate that mapped field values conform to the Salesforce object's field types/lengths","Reduce meta.getBatchSizeInt() to isolate which row/record fails","Enable error handling on the step to route failed rows to an error stream"],"exampleFix":null,"handlingStrategy":"retry","validationCode":"for (Object[] row : pendingRows) {\n  Object val = row[fieldIndex];\n  if (val == null && requiredField) throw new IllegalArgumentException(\"Required value missing\");\n  if (val instanceof String && ((String) val).length() > maxLen) throw new IllegalArgumentException(\"Value too long\");\n}","typeGuard":null,"tryCatchPattern":"try {\n  writeToSalesForce(row);\n} catch (KettleException e) {\n  if (isTransient(e)) retryWithBackoff(row);\n  else log.error(\"Non-retryable Salesforce batch error: {}\", e.getMessage(), e);\n}","preventionTips":["Validate row data against Salesforce field types/lengths before batching","Reduce batch size to isolate failing records","Enable step error handling to divert bad rows to an error stream"],"tags":["kettle","salesforce","batch","wrapped-exception"],"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"}