{"record":{"id":"bc8570207fdefc73","repo":"pentaho/pentaho-kettle","slug":"writetolog-error-unabletosavetorepository-label","errorCode":null,"errorMessage":"WriteToLog.Error.UnableToSaveToRepository.Label","messagePattern":"WriteToLog\\.Error\\.UnableToSaveToRepository\\.Label","errorType":"exception","errorClass":"KettleException","httpStatus":null,"severity":"error","filePath":"engine/src/main/java/org/pentaho/di/job/entries/writetolog/JobEntryWriteToLog.java","lineNumber":132,"sourceCode":"      logsubject = rep.getJobEntryAttributeString( id_jobentry, \"logsubject\" );\n    } catch ( KettleDatabaseException dbe ) {\n      throw new KettleException( BaseMessages.getString( PKG, \"WriteToLog.Error.UnableToLoadFromRepository.Label\" )\n        + id_jobentry, dbe );\n\n    }\n  }\n\n  // Save the attributes of this job entry\n  //\n  @Override\n  public void saveRep( Repository rep, IMetaStore metaStore, ObjectId id_job ) throws KettleException {\n    try {\n      rep.saveJobEntryAttribute( id_job, getObjectId(), \"logmessage\", logmessage );\n      rep.saveJobEntryAttribute( id_job, getObjectId(), \"loglevel\", ( entryLogLevel != null ? entryLogLevel\n        .getCode() : \"\" ) );\n      rep.saveJobEntryAttribute( id_job, getObjectId(), \"logsubject\", logsubject );\n    } catch ( KettleDatabaseException dbe ) {\n      throw new KettleException( BaseMessages.getString( PKG, \"WriteToLog.Error.UnableToSaveToRepository.Label\" )\n        + id_job, dbe );\n    }\n  }\n\n  private class LogWriterObject implements LoggingObjectInterface {\n\n    private LogChannelInterface writerLog;\n\n    private LogLevel logLevel;\n    private LoggingObjectInterface parent;\n    private String subject;\n    private String containerObjectId;\n\n    public LogWriterObject( String subject, LoggingObjectInterface parent, LogLevel logLevel ) {\n      this.subject = subject;\n      this.parent = parent;\n      this.logLevel = logLevel;\n      this.writerLog = new LogChannel( this, parent );","sourceCodeStart":114,"sourceCodeEnd":150,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/engine/src/main/java/org/pentaho/di/job/entries/writetolog/JobEntryWriteToLog.java#L114-L150","documentation":"JobEntryWriteToLog.saveRep() throws this KettleException when persisting the entry's attributes (logmessage, loglevel, logsubject) to the repository fails with a KettleDatabaseException. The job ObjectId is appended and the DB exception is the cause.","triggerScenarios":"Calling saveRep when the repository DB is down, the r_jobentry_attribute insert/update fails (constraint violation, lock timeout, insufficient privileges, read-only repository).","commonSituations":"Repository DB in read-only mode; disk full on DB server; concurrent edits causing row locks; missing INSERT privilege on repository schema.","solutions":["Check DB connectivity, privileges, and disk space for the repository database","Inspect the cause KettleDatabaseException for the failing SQL statement","Retry saving after resolving locks (e.g. another user editing the same job)","Verify the repository schema is up to date with your Pentaho version"],"exampleFix":"// before: failing insert due to read-only repo\nrep.saveJobEntryAttribute( id_job, getObjectId(), \"logmessage\", logmessage );\n// after: ensure writable connection first\nif ( rep.isReadOnly() ) { throw new IllegalStateException( \"Repository is read-only\" ); }\nrep.saveJobEntryAttribute( id_job, getObjectId(), \"logmessage\", logmessage );","handlingStrategy":"try-catch","validationCode":"// pre-checks before saveRep\nif ( rep.isReadOnly() ) throw new KettleException( \"Repository read-only\" );\nif ( getObjectId() == null ) throw new KettleException( \"Entry not saved yet (no ObjectId)\" );","typeGuard":null,"tryCatchPattern":"try {\n  jobEntry.saveRep( rep, metaStore, id_job );\n} catch ( KettleException e ) {\n  Throwable cause = e.getCause();\n  if ( cause instanceof KettleDatabaseException ) {\n    logError( \"DB write failed while saving entry, cause: \" + cause.getMessage() );\n  }\n}","preventionTips":["Ensure the repository DB user has INSERT/UPDATE on r_jobentry_attribute","Avoid concurrent edits of the same job in multiple Spoon sessions","Watch DB disk space; write failures often follow a full tablespace"],"tags":["database","repository","pdi","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"}