pentaho/pentaho-kettle · error · KettleException

WriteToLog.Error.UnableToSaveToRepository.Label

Error message

WriteToLog.Error.UnableToSaveToRepository.Label

What it means

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.

Solutions

  1. Check DB connectivity, privileges, and disk space for the repository database
  2. Inspect the cause KettleDatabaseException for the failing SQL statement
  3. Retry saving after resolving locks (e.g. another user editing the same job)
  4. Verify the repository schema is up to date with your Pentaho version

Example fix

// before: failing insert due to read-only repo
rep.saveJobEntryAttribute( id_job, getObjectId(), "logmessage", logmessage );
// after: ensure writable connection first
if ( rep.isReadOnly() ) { throw new IllegalStateException( "Repository is read-only" ); }
rep.saveJobEntryAttribute( id_job, getObjectId(), "logmessage", logmessage );
Defensive patterns

Strategy: try-catch

Validate before calling

// pre-checks before saveRep
if ( rep.isReadOnly() ) throw new KettleException( "Repository read-only" );
if ( getObjectId() == null ) throw new KettleException( "Entry not saved yet (no ObjectId)" );

Try / catch

try {
  jobEntry.saveRep( rep, metaStore, id_job );
} catch ( KettleException e ) {
  Throwable cause = e.getCause();
  if ( cause instanceof KettleDatabaseException ) {
    logError( "DB write failed while saving entry, cause: " + cause.getMessage() );
  }
}

Prevention

When it happens

Trigger: Calling saveRep when the repository DB is down, the r_jobentry_attribute insert/update fails (constraint violation, lock timeout, insufficient privileges, read-only repository).

Common situations: Repository DB in read-only mode; disk full on DB server; concurrent edits causing row locks; missing INSERT privilege on repository schema.

Related errors


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

Appendix: source

Thrown at engine/src/main/java/org/pentaho/di/job/entries/writetolog/JobEntryWriteToLog.java:132

      logsubject = rep.getJobEntryAttributeString( id_jobentry, "logsubject" );
    } catch ( KettleDatabaseException dbe ) {
      throw new KettleException( BaseMessages.getString( PKG, "WriteToLog.Error.UnableToLoadFromRepository.Label" )
        + id_jobentry, dbe );

    }
  }

  // Save the attributes of this job entry
  //
  @Override
  public void saveRep( Repository rep, IMetaStore metaStore, ObjectId id_job ) throws KettleException {
    try {
      rep.saveJobEntryAttribute( id_job, getObjectId(), "logmessage", logmessage );
      rep.saveJobEntryAttribute( id_job, getObjectId(), "loglevel", ( entryLogLevel != null ? entryLogLevel
        .getCode() : "" ) );
      rep.saveJobEntryAttribute( id_job, getObjectId(), "logsubject", logsubject );
    } catch ( KettleDatabaseException dbe ) {
      throw new KettleException( BaseMessages.getString( PKG, "WriteToLog.Error.UnableToSaveToRepository.Label" )
        + id_job, dbe );
    }
  }

  private class LogWriterObject implements LoggingObjectInterface {

    private LogChannelInterface writerLog;

    private LogLevel logLevel;
    private LoggingObjectInterface parent;
    private String subject;
    private String containerObjectId;

    public LogWriterObject( String subject, LoggingObjectInterface parent, LogLevel logLevel ) {
      this.subject = subject;
      this.parent = parent;
      this.logLevel = logLevel;
      this.writerLog = new LogChannel( this, parent );

View on GitHub (pinned to f3058517a1)