{"record":{"id":"42b28cfd47352941","repo":"pentaho/pentaho-kettle","slug":"unable-to-insert-new-version-log-record-into-schematable","errorCode":null,"errorMessage":"Unable to insert new version log record into {schemaTable}","messagePattern":"Unable to insert new version log record into (.+?)","errorType":"exception","errorClass":"KettleException","httpStatus":null,"severity":"error","filePath":"engine/src/main/java/org/pentaho/di/repository/kdr/KettleDatabaseRepositoryCreationHelper.java","lineNumber":227,"sourceCode":"      } else {\n        nextId = new LongObjectId( 1L );\n      }\n      Object[] data =\n        new Object[] {\n          nextId.longValue(),\n          Long.valueOf( KettleDatabaseRepositoryConnectionDelegate.REQUIRED_MAJOR_VERSION ),\n          Long.valueOf( KettleDatabaseRepositoryConnectionDelegate.REQUIRED_MINOR_VERSION ), new Date(),\n          Boolean.valueOf( upgrade ), };\n      if ( dryrun ) {\n        sql = database.getSQLOutput( null, KettleDatabaseRepository.TABLE_R_VERSION, table, data, null );\n        statements.add( sql );\n      } else {\n        database.execStatement( \"INSERT INTO \"\n          + databaseMeta.getQuotedSchemaTableCombination( null, KettleDatabaseRepository.TABLE_R_VERSION )\n          + \" VALUES(?, ?, ?, ?, ?)\", table, data );\n      }\n    } catch ( KettleException e ) {\n      throw new KettleException( \"Unable to insert new version log record into \" + schemaTable, e );\n    }\n\n    // ////////////////////////////////////////////////////////////////////////////////\n    // R_DATABASE_TYPE\n    //\n    // Create table...\n    //\n    boolean ok_database_type = true;\n    table = new RowMeta();\n    tablename = KettleDatabaseRepository.TABLE_R_DATABASE_TYPE;\n    schemaTable = databaseMeta.getQuotedSchemaTableCombination( null, tablename );\n    if ( monitor != null ) {\n      monitor.subTask( \"Checking table \" + schemaTable );\n    }\n    table.addValueMeta( new ValueMetaInteger(\n      KettleDatabaseRepository.FIELD_DATABASE_TYPE_ID_DATABASE_TYPE, KEY, 0 ) );\n    table.addValueMeta( new ValueMetaString(\n      KettleDatabaseRepository.FIELD_DATABASE_TYPE_CODE,","sourceCodeStart":209,"sourceCodeEnd":245,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/engine/src/main/java/org/pentaho/di/repository/kdr/KettleDatabaseRepositoryCreationHelper.java#L209-L245","documentation":"During repository creation the helper inserts the initial version-log row into R_VERSION using a prepared INSERT; any KettleException from that statement is wrapped as 'Unable to insert new version log record into <schemaTable>'. Without this row the repository version stamp is missing.","triggerScenarios":"createRepositorySchema() (or its test callers) executes INSERT INTO R_VERSION VALUES(?,?,?,?,?) and the database rejects it — e.g. table exists with different column count, duplicate key from a prior install, or insert privileges missing.","commonSituations":"Re-running repository creation on an existing schema where R_VERSION is already populated; table created manually with a wrong column layout; user lacking INSERT privileges.","solutions":["Check if R_VERSION already has a row; skip version seeding or delete the duplicate first.","Verify R_VERSION has exactly the 5 expected columns of the current Pentaho version.","Grant INSERT privilege on the repository schema to the connecting user.","Inspect the wrapped KettleException for the exact JDBC error."],"exampleFix":"// before\nrepo.connect(...); // re-seeds R_VERSION, duplicate key\n// after\nif (!database.checkTableExists(TABLE_R_VERSION) || database.getOneRow(\"SELECT * FROM \" + TABLE_R_VERSION) == null) {\n  repo.connect(...); // safe to create/seed\n}","handlingStrategy":"validation","validationCode":"// skip seeding when R_VERSION already populated\nif (database.checkTableExists(KettleDatabaseRepository.TABLE_R_VERSION)\n    && database.getOneRow(\"SELECT * FROM \" + KettleDatabaseRepository.TABLE_R_VERSION) != null) {\n  return; // version already seeded\n}","typeGuard":null,"tryCatchPattern":"try {\n  repo.createRepositorySchema(monitor, false);\n} catch (KettleException e) {\n  if (e.getMessage().contains(\"R_VERSION\")) {\n    // handle duplicate/seed conflict\n  }\n}","preventionTips":["Never re-run creation against an already-seeded R_VERSION.","Keep R_VERSION column layout aligned with the Pentaho version.","Ensure INSERT privileges on the repository schema.","Inspect cause chain for duplicate-key JDBC errors."],"tags":["database","insert","version-log"],"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"}