pentaho/pentaho-kettle · error · KettleException

JobEntrySetVariables.Meta.UnableSaveRep

Error message

JobEntrySetVariables.Meta.UnableSaveRep

What it means

This KettleException is thrown in saveRep when persisting the Set Variables entry's variable rows to the repository fails with a KettleDatabaseException. The message includes id_job and the DB error text, with the original exception as cause. It flags a repository write failure for this entry's variable_name/variable_value/variable_type attributes.

Solutions

  1. Read the chained KettleDatabaseException and fix the DB issue (connectivity, locks, permissions)
  2. Grant the repository user INSERT/UPDATE on R_JOBENTRY_ATTRIBUTE
  3. Ensure the job entry is saved to the repository first (valid ObjectId) before attributes are written
  4. Retry the save; if schema mismatch, run repository upgrade/repair tools

Example fix

// before
entry.saveRep(rep, metaStore, idJob);
// after
try {
  entry.saveRep(rep, metaStore, idJob);
} catch (KettleException e) {
  logError("Save of Set Variables failed for job " + idJob + ": " + e.getMessage(), e);
  // verify DB write access and ObjectId, then retry
}
Defensive patterns

Strategy: try-catch

Validate before calling

if (entry.getObjectId() == null) throw new IllegalStateException("Save the job entry to the repository first");
if (id_job == null) throw new IllegalArgumentException("id_job is null");

Try / catch

try {
  entry.saveRep(rep, metaStore, idJob);
} catch (KettleException e) {
  logError("Repository save failed for job " + id_job + ": " + e.getMessage(), e);
  // check DB write access, retry after recovery
}

Prevention

When it happens

Trigger: Saving the job when rep.saveJobEntryAttribute throws for one of the variable rows: connection lost mid-loop, read-only DB, constraint violation, or null id_job/ObjectId.

Common situations: Network drop to repository DB while saving a job with many variables; DB account lacking write permission; duplicate/constraint issues after repository restore; saving from an unauthenticated repository session.

Related errors


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

Appendix: source

Thrown at engine/src/main/java/org/pentaho/di/job/entries/setvariables/JobEntrySetVariables.java:214

  public void saveRep( Repository rep, IMetaStore metaStore, ObjectId id_job ) throws KettleException {
    try {
      rep.saveJobEntryAttribute( id_job, getObjectId(), "replacevars", replaceVars );

      rep.saveJobEntryAttribute( id_job, getObjectId(), "filename", filename );
      rep.saveJobEntryAttribute(
        id_job, getObjectId(), "file_variable_type", getVariableTypeCode( fileVariableType ) );

      // save the variableName...
      if ( variableName != null ) {
        for ( int i = 0; i < variableName.length; i++ ) {
          rep.saveJobEntryAttribute( id_job, getObjectId(), i, "variable_name", variableName[i] );
          rep.saveJobEntryAttribute( id_job, getObjectId(), i, "variable_value", variableValue[i] );
          rep.saveJobEntryAttribute(
            id_job, getObjectId(), i, "variable_type", getVariableTypeCode( variableType[i] ) );
        }
      }
    } catch ( KettleDatabaseException dbe ) {
      throw new KettleException( BaseMessages.getString( PKG, "JobEntrySetVariables.Meta.UnableSaveRep", String
        .valueOf( id_job ), dbe.getMessage() ), dbe );
    }
  }

  public Result execute( Result result, int nr ) throws KettleException {
    result.setResult( true );
    result.setNrErrors( 0 );
    try {

      List<String> variables = new ArrayList<String>();
      List<String> variableValues = new ArrayList<String>();
      List<Integer> variableTypes = new ArrayList<Integer>();

      String realFilename = environmentSubstitute( filename );
      if ( !Utils.isEmpty( realFilename ) ) {
        try ( InputStream is = KettleVFS.getInstance( parentJobMeta.getBowl() ).getInputStream( realFilename );
            // for UTF8 properties files
            InputStreamReader isr = new InputStreamReader( is, "UTF-8" );

View on GitHub (pinned to f3058517a1)