{"record":{"id":"911c6b3bf7ad1609","repo":"pentaho/pentaho-kettle","slug":"trans-exception-errorwritinglogrecordtotable","errorCode":null,"errorMessage":"Trans.Exception.ErrorWritingLogRecordToTable","messagePattern":"Trans\\.Exception\\.ErrorWritingLogRecordToTable","errorType":"exception","errorClass":"KettleTransException","httpStatus":null,"severity":"critical","filePath":"engine/src/main/java/org/pentaho/di/trans/Trans.java","lineNumber":2599,"sourceCode":"                  \"Trans.Exception.UnableToPerformIntervalPerformanceLogging\" ), e );\n                // Also stop the show...\n                //\n                errors.incrementAndGet();\n                stopAll();\n              }\n            }\n          };\n          timer.schedule( timerTask, perfLogInterval * 1000, perfLogInterval * 1000 );\n\n          addTransListener( new TransAdapter() {\n            @Override\n            public void transFinished( Trans trans ) {\n              timer.cancel();\n            }\n          } );\n        }\n      } catch ( KettleException e ) {\n        throw new KettleTransException( BaseMessages.getString( PKG, \"Trans.Exception.ErrorWritingLogRecordToTable\",\n          logTable ), e );\n      } finally {\n        // If we use interval logging, we keep the connection open for performance reasons...\n        //\n        if ( transLogTableDatabaseConnection != null && ( intervalInSeconds <= 0 ) ) {\n          transLogTableDatabaseConnection.disconnect();\n          transLogTableDatabaseConnection = null;\n        }\n      }\n    } catch ( KettleException e ) {\n      throw new KettleTransException( BaseMessages.getString( PKG,\n        \"Trans.Exception.UnableToBeginProcessingTransformation\" ), e );\n    }\n  }\n\n  /**\n   * Writes log channel information to a channel logging table (if one has been configured).\n   *","sourceCodeStart":2581,"sourceCodeEnd":2617,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/engine/src/main/java/org/pentaho/di/trans/Trans.java#L2581-L2617","documentation":"Thrown by Trans.beginProcessing() when writing the initial transformation log record to the transformation log table fails with a KettleException. This is the very first logging write during startup (when interval logging is configured a timer is also set up), so failure here aborts the transformation before any step runs.","triggerScenarios":"beginProcessing() writes the start log record via the transLogTableDatabaseConnection; any KettleException (connection failure, SQL error, missing table) is rethrown as KettleTransException(ErrorWritingLogRecordToTable, logTable).","commonSituations":"Wrong log database connection credentials; transformation log table does not exist; database max connections exhausted; network unreachable at startup; log table columns altered after a PDI upgrade.","solutions":["Inspect the cause for the root SQL/connection error and fix the transformation log database first.","Verify the transformation log table exists with the expected schema; regenerate it from the Log tab 'SQL' button.","Test the database connection and credentials used by the transformation log table.","Check DB server logs for connection limits or quota issues if the cause shows resource exhaustion."],"exampleFix":"// before: log table dropped after DB migration\nKettleTransException: ErrorWritingLogRecordToTable [trans_log]\n// after: recreate trans_log (Log tab SQL) or point the log table at a live connection","handlingStrategy":"validation","validationCode":"// Pre-flight: connect to the trans log DB and confirm the table before execution\nDatabaseMeta meta = transMeta.getTransLogTable().getDatabaseMeta();\nDatabase db = new Database(trans, meta);\ndb.connect();\nif (!db.checkTableExists(\"TRANS_LOG\")) throw new IllegalStateException(\"TRANS_LOG missing\");\ndb.disconnect();","typeGuard":null,"tryCatchPattern":"try {\n  trans.execute(null);\n} catch (KettleTransException e) {\n  log.error(\"Cannot start transformation: initial log record write failed\", e.getCause());\n  alertOps(); // startup aborts before any step runs\n}","preventionTips":["Test the transformation log connection as part of job scheduling pre-checks.","Recreate log tables after PDI version upgrades.","Monitor database connection limits to avoid startup-time exhaustion."],"tags":["database","logging","startup","transformation"],"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"}