{"record":{"id":"431e7096f40c7ea3","repo":"pentaho/pentaho-kettle","slug":"jobpgpencryptfiles-error-exception-unablesaverep","errorCode":null,"errorMessage":"JobPGPEncryptFiles.Error.Exception.UnableSaveRep","messagePattern":"JobPGPEncryptFiles\\.Error\\.Exception\\.UnableSaveRep","errorType":"exception","errorClass":"KettleException","httpStatus":null,"severity":"error","filePath":"engine/src/main/java/org/pentaho/di/job/entries/pgpencryptfiles/JobEntryPGPEncryptFiles.java","lineNumber":396,"sourceCode":"      rep\n        .saveJobEntryAttribute(\n          id_job, getObjectId(), \"AddMovedDateBeforeExtension\", AddMovedDateBeforeExtension );\n      rep.saveJobEntryAttribute( id_job, getObjectId(), \"asciiMode\", asciiMode );\n\n      // save the arguments...\n      if ( source_filefolder != null ) {\n        for ( int i = 0; i < source_filefolder.length; i++ ) {\n          rep.saveJobEntryAttribute( id_job, getObjectId(), i, \"action_type\", getActionTypeCode( action_type[i] ) );\n          rep.saveJobEntryAttribute( id_job, getObjectId(), i, \"source_filefolder\", source_filefolder[i] );\n          rep.saveJobEntryAttribute( id_job, getObjectId(), i, \"userid\", userid[i] );\n          rep\n            .saveJobEntryAttribute(\n              id_job, getObjectId(), i, \"destination_filefolder\", destination_filefolder[i] );\n          rep.saveJobEntryAttribute( id_job, getObjectId(), i, \"wildcard\", wildcard[i] );\n        }\n      }\n    } catch ( KettleDatabaseException dbe ) {\n      throw new KettleException( BaseMessages.getString( PKG, \"JobPGPEncryptFiles.Error.Exception.UnableSaveRep\" )\n        + id_job, dbe );\n    }\n  }\n\n  public Result execute( Result previousResult, int nr ) {\n    Result result = previousResult;\n    List<RowMetaAndData> rows = result.getRows();\n    RowMetaAndData resultRow = null;\n    result.setNrErrors( 1 );\n    result.setResult( false );\n\n    try {\n\n      NrErrors = 0;\n      NrSuccess = 0;\n      successConditionBroken = false;\n      successConditionBrokenExit = false;\n      limitFiles = Const.toInt( environmentSubstitute( getNrErrorsLessThan() ), 10 );","sourceCodeStart":378,"sourceCodeEnd":414,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/engine/src/main/java/org/pentaho/di/job/entries/pgpencryptfiles/JobEntryPGPEncryptFiles.java#L378-L414","documentation":"JobEntryPGPEncryptFiles.saveRep wraps any KettleDatabaseException raised while persisting the entry's attributes (gpg location, userid, destination_filefolder, wildcard arrays) into a KettleException with the localized 'UnableSaveRep' message and the job id. It signals that the job entry could not be written to the repository; the database error is preserved as the cause.","triggerScenarios":"Calling saveRep (directly or via saving a job) when a rep.saveJobEntryAttribute call throws KettleDatabaseException: repository connection lost, constraint violation, read-only database, or schema mismatch on r_jobentry_attribute.","commonSituations":"Repository database is read-only or out of space; DB session dropped during a long save; schema drift after a Pentaho upgrade; duplicate/foreign-key issues on the job entry rows.","solutions":["Check the cause (KettleDatabaseException) for the specific SQL error and fix the repository DB issue (connectivity, permissions, disk space)","Confirm the repository schema matches the installed Pentaho version and run any pending upgrade scripts","Retry the save after restoring the connection; if rows are partially written, clean up orphan r_jobentry_attribute rows and re-save"],"exampleFix":"// before\nentry.saveRep(rep, metaStore, idJob); // surfaces as UnableSaveRep\n// after\ntry {\n  entry.saveRep(rep, metaStore, idJob);\n} catch (KettleException e) {\n  logError(\"Could not save PGP encrypt entry to repository: \" + e.getCause(), e);\n  // notify user the job was not persisted\n}","handlingStrategy":"try-catch","validationCode":"// before saveRep\nif (rep == null || id_job == null) throw new KettleException(\"Repository or job id missing\");\nrep.connect(); // fail fast if DB unreachable","typeGuard":null,"tryCatchPattern":"try {\n  entry.saveRep(rep, metaStore, idJob);\n} catch (KettleException e) {\n  logError(\"Repository save failed: \" + e.getCause(), e);\n  // surface to user that the job was NOT persisted; retry after fixing DB\n}","preventionTips":["Save jobs through the standard Spoon/repo.save flow so ObjectId is valid before attribute saves","Monitor repository DB for read-only states, disk space, and connection limits","Apply schema upgrade scripts after Pentaho version changes"],"tags":["persistence","repository","database-write","kettle"],"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"}