{"record":{"id":"25f3457ccac79396","repo":"pentaho/pentaho-kettle","slug":"unable-to-commit-repository-connection","errorCode":null,"errorMessage":"Unable to commit repository connection","messagePattern":"Unable to commit repository connection","errorType":"exception","errorClass":"KettleException","httpStatus":null,"severity":"error","filePath":"engine/src/main/java/org/pentaho/di/repository/kdr/delegates/KettleDatabaseRepositoryConnectionDelegate.java","lineNumber":287,"sourceCode":"      database.setCommit( 0 );\n    }\n  }\n\n  public synchronized void commit() throws KettleException {\n    try {\n      closeJobAttributeInsertPreparedStatement();\n      closeStepAttributeInsertPreparedStatement();\n      closeTransAttributeInsertPreparedStatement();\n\n      if ( !database.isAutoCommit() ) {\n        database.commit();\n      }\n\n      // Also, clear the counters, reducing the risk of collisions!\n      //\n      Counters.getInstance().clear();\n    } catch ( KettleException dbe ) {\n      throw new KettleException( \"Unable to commit repository connection\", dbe );\n    }\n  }\n\n  public synchronized void rollback() {\n    try {\n      database.rollback();\n\n      // Also, clear the counters, reducing the risk of collisions!\n      //\n      Counters.getInstance().clear();\n    } catch ( KettleException dbe ) {\n      log.logError( \"Error rolling back repository.\" );\n    }\n  }\n\n  /**\n   * @return the database\n   */","sourceCodeStart":269,"sourceCodeEnd":305,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/engine/src/main/java/org/pentaho/di/repository/kdr/delegates/KettleDatabaseRepositoryConnectionDelegate.java#L269-L305","documentation":"Wraps any KettleException raised while committing the repository database connection during commit(). A failed commit leaves repository writes uncommitted, and the delegate also clears Counters on the success path, so this error signals the repository session could not be finalized. Always caused by an underlying database exception (dbe) attached as the cause.","triggerScenarios":"KettleDatabaseRepositoryConnectionDelegate.commit() fails, e.g. database.commit() throws due to connection loss, deadlock, or an earlier statement error, typically invoked through disconnect() at session close.","commonSituations":"Network drop or database restart mid-session; transaction aborted by a constraint violation in an earlier operation; DBA killing a long-lived repository session; connection pool timeout.","solutions":["Inspect the cause (KettleException dbe) for the underlying database error and fix that first","Verify the repository database connection is alive and reachable (network, firewall, DB uptime)","Retry the repository operation after reconnecting; uncommitted changes are lost","Check database logs for deadlock/rollback reasons and adjust transaction handling or load"],"exampleFix":"// before\ntry {\n  repository.disconnect();\n} catch (KettleException e) {\n  // only top message: 'Unable to commit repository connection'\n  log.error(e.getMessage());\n}\n// after\ntry {\n  repository.disconnect();\n} catch (KettleException e) {\n  log.error(\"Repository commit failed\", e); // inspect cause for DB-level error\n  // reconnect and retry if appropriate\n}","handlingStrategy":"try-catch","validationCode":"// verify connectivity before a long repository session\nif (!database.checkConnectionOpen()) { reconnect(); }","typeGuard":null,"tryCatchPattern":"try {\n  repository.disconnect();\n} catch (KettleException e) {\n  Throwable cause = e.getCause();\n  log.error(\"Repository commit failed: \" + (cause != null ? cause.getMessage() : e.getMessage()), e);\n  // decide reconnect/retry\n}","preventionTips":["Keep repository sessions short; commit frequently","Monitor repository DB uptime and network stability","Avoid concurrent long transactions on the same repository rows"],"tags":["database","commit","transaction","repository"],"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"}