{"record":{"id":"34c9e1c65e6c6085","repo":"pentaho/pentaho-kettle","slug":"salesforceupsertmeta-exception-errorsavingtorepository","errorCode":null,"errorMessage":"SalesforceUpsertMeta.Exception.ErrorSavingToRepository","messagePattern":"SalesforceUpsertMeta\\.Exception\\.ErrorSavingToRepository","errorType":"exception","errorClass":"KettleException","httpStatus":null,"severity":"error","filePath":"plugins/salesforce/core/src/main/java/org/pentaho/di/trans/steps/salesforceupsert/SalesforceUpsertMeta.java","lineNumber":332,"sourceCode":"  }\n\n  public void saveRep( Repository rep, IMetaStore metaStore, ObjectId id_transformation, ObjectId id_step ) throws KettleException {\n    super.saveRep( rep, metaStore, id_transformation, id_step );\n    try {\n      rep.saveStepAttribute( id_transformation, id_step, \"batchSize\", getBatchSize() );\n      rep.saveStepAttribute( id_transformation, id_step, \"upsertfield\", getUpsertField() );\n      rep.saveStepAttribute( id_transformation, id_step, \"salesforceIDFieldName\", getSalesforceIDFieldName() );\n\n      for ( int i = 0; i < updateLookup.length; i++ ) {\n        rep.saveStepAttribute( id_transformation, id_step, i, \"field_name\", getUpdateLookup()[i] );\n        rep.saveStepAttribute( id_transformation, id_step, i, \"field_attribut\", getUpdateStream()[i] );\n        rep.saveStepAttribute( id_transformation, id_step, i, \"field_useExternalId\", getUseExternalId()[i]\n          .booleanValue() );\n\n      }\n      rep.saveStepAttribute( id_transformation, id_step, \"rollbackAllChangesOnError\", isRollbackAllChangesOnError() );\n    } catch ( Exception e ) {\n      throw new KettleException( BaseMessages.getString(\n        PKG, \"SalesforceUpsertMeta.Exception.ErrorSavingToRepository\", \"\" + id_step ), e );\n    }\n  }\n\n  public void check( List<CheckResultInterface> remarks, TransMeta transMeta, StepMeta stepMeta,\n    RowMetaInterface prev, String[] input, String[] output, RowMetaInterface info, VariableSpace space,\n    Repository repository, IMetaStore metaStore ) {\n    super.check( remarks, transMeta, stepMeta, prev, input, output, info, space, repository, metaStore );\n    CheckResult cr;\n\n    // See if we get input...\n    if ( input != null && input.length > 0 ) {\n      cr =\n        new CheckResult( CheckResult.TYPE_RESULT_ERROR, BaseMessages.getString(\n          PKG, \"SalesforceUpsertMeta.CheckResult.NoInputExpected\" ), stepMeta );\n    } else {\n      cr =\n        new CheckResult( CheckResult.TYPE_RESULT_OK, BaseMessages.getString(","sourceCodeStart":314,"sourceCodeEnd":350,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/plugins/salesforce/core/src/main/java/org/pentaho/di/trans/steps/salesforceupsert/SalesforceUpsertMeta.java#L314-L350","documentation":"This KettleException is thrown by SalesforceUpsertMeta.saveRep() when any repository write (saveStepAttribute) for this step's metadata fails. It wraps the underlying exception and includes the id_step of the step being saved, so a transformation save to a repository (database or file-based) is aborted.","triggerScenarios":"Any Exception while calling rep.saveStepAttribute during saveRep — e.g. repository connection lost mid-save, schema/table missing or locked, constraint violation writing the step attribute rows, or a null/invalid attribute array (getUseExternalId() with fewer entries than field count).","commonSituations":"Saving a transformation with a Salesforce Upsert step when the repository database went down or the user lost permissions; corrupted repository metadata tables; mismatch between saved field count arrays after editing the step.","solutions":["Check the wrapped cause 'e' to find the real repository error (connection, permissions, schema).","Verify the Kettle repository (DB or file) is reachable and the connected user has write rights on r_step_attribute.","If using a DB repository, check the repository tables exist and aren't locked/corrupted; run repository repair/upgrade tools if needed.","Re-open and re-save the step in Spoon to regenerate consistent metadata arrays.","As a last resort, export the transformation to XML and re-import into a fresh repository."],"exampleFix":"// before\nrep.saveStepAttribute( id_transformation, id_step, \"rollbackAllChangesOnError\", isRollbackAllChangesOnError() );\n// after — ensure repository is connected before saving\nif ( rep != null && rep.isConnected() ) {\n  rep.saveStepAttribute( id_transformation, id_step, \"rollbackAllChangesOnError\", isRollbackAllChangesOnError() );\n}","handlingStrategy":"try-catch","validationCode":"// before saving\nif ( rep == null || !rep.isConnected() ) { throw new KettleException(\"Repository not connected\"); }\nif ( getUpdateLookup() != null && getUseExternalId() != null && getUseExternalId().length != getUpdateLookup().length ) {\n  throw new KettleException(\"Field metadata arrays out of sync\");\n}","typeGuard":null,"tryCatchPattern":"try { saveRep(...); } catch ( KettleException e ) { logError(\"Repository save failed for id_step=\" + id_step + \": \" + e.getCause(), e); throw e; }","preventionTips":["Always check repository connectivity before batch saves.","Keep field arrays (lookup, useExternalId, etc.) in sync when editing step metadata.","Use repository health checks / upgrade tools after PDI version upgrades.","Wrap repository saves with retry for transient DB issues."],"tags":["kettle","salesforce","repository","persistence"],"backgroundTag":"database-write-failed","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"}