pentaho/pentaho-kettle · error · KettleJobException

Unable to end processing by writing log record to table

Error message

Unable to end processing by writing log record to table {tableName}

What it means

Thrown at the end of job processing when updating the log table with the final (END) record raises a KettleDatabaseException. An error is added to the result and the exception is chained; commitLog and close still run in the finally block.

Solutions

  1. Read the chained KettleDatabaseException for the exact SQL error
  2. Increase connection idle/keepalive timeouts for long jobs
  3. Verify job log table schema and privileges
  4. Check for DB locks or maintenance windows coinciding with job end
Defensive patterns

Strategy: try-catch

Validate before calling

// guard against long-job connection drops
if (expectedJobDurationMinutes > 30) {
  configureConnectionKeepalive(logDbConnection, 60); // seconds
}

Try / catch

try {
  job.run();
} catch (KettleJobException e) {
  if (e.getMessage().contains("Unable to end processing by writing log record")) {
    Throwable dbe = e.getCause();
    if (dbe != null && dbe.getMessage().contains("connection")) {
      // reconnect and finalize log manually or retry the job
    }
    log.error("Job END log write failed", dbe);
  }
}

Prevention

When it happens

Trigger: The final log-record write (or cleanupLogRecords) against the job log table fails: connection lost, table missing/locked, schema drift, or constraint failure during the END-status update.

Common situations: Long-running jobs outliving DB connection idle timeouts; DB maintenance/locks during job execution; log table altered externally; network partition at job completion.

Related errors


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

Appendix: source

Thrown at engine/src/main/java/org/pentaho/di/job/Job.java:1219

    KettleDatabaseException {
    boolean cleanLogRecords = status.equals( LogStatus.END );
    String tableName = jobLogTable.getActualTableName();
    DatabaseMeta logcon = jobLogTable.getDatabaseMeta();

    Database ldb = createDataBase( logcon );
    ldb.shareVariablesWith( this );
    try {
      ldb.connect();
      ldb.setCommit( logCommitSize );
      ldb.writeLogRecord( jobLogTable, status, this, null );

      if ( cleanLogRecords ) {
        ldb.cleanupLogRecords( jobLogTable, getJobname() );
      }

    } catch ( KettleDatabaseException dbe ) {
      addErrors( 1 );
      throw new KettleJobException( "Unable to end processing by writing log record to table " + tableName, dbe );
    } finally {
      if ( !ldb.isAutoCommit() ) {
        ldb.commitLog( true, jobLogTable );
      }
      ldb.close();
    }
  }

  /**
   * Write log channel information.
   *
   * @throws KettleException
   *           the kettle exception
   */
  protected void writeLogChannelInformation() throws KettleException {
    Database db = null;
    ChannelLogTable channelLogTable = jobMeta.getChannelLogTable();

View on GitHub (pinned to f3058517a1)