pentaho/pentaho-kettle · error · KettleException

Unable to create or modify table

Error message

Unable to create or modify table {schemaTable}

What it means

createRepositorySchema() executes generated DDL for each required repository table via database.execStatements(sql); if the database throws a KettleException the helper wraps it as 'Unable to create or modify table <schemaTable>'. This occurs during repository connect-with-upgrade/create flows.

Solutions

  1. Grant CREATE/ALTER TABLE privileges to the repository database user.
  2. Check the nested KettleException/database error for the exact SQL failure and fix the dialect issue.
  3. Drop or repair the partially created repository table and re-run creation.
  4. Use a supported database type/version for the Kettle database repository.

Example fix

// before
repo.connect(repoMeta); // auto-creates schema, fails on DDL privilege
// after
if (!database.checkTableExists(TABLE_R_VERSION)) {
  grantDdlPrivileges(repoUser); // ensure CREATE TABLE allowed
}
repo.connect(repoMeta);
Defensive patterns

Strategy: validation

Validate before calling

DatabaseMeta db = repoMeta.getConnection();
if (!db.testConnection()) throw new IllegalStateException("repository DB unreachable");
// user needs CREATE/ALTER privileges on the schema

Try / catch

try {
  repo.createRepositorySchema(monitor, false);
} catch (KettleException e) {
  log.error("table creation failed: " + e.getCause(), e);
}

Prevention

When it happens

Trigger: Calling KettleDatabaseRepository.connect()/createRepositorySchema (indirectly from testCreateIndexLenghts, testDatabaseRepository, setUpBeforeClass) when CREATE/ALTER TABLE fails — insufficient privileges, unsupported SQL for the target database dialect, or the table exists in an incompatible state.

Common situations: First-time repository creation against a database user without DDL rights; unsupported/older database dialect producing invalid generated SQL; partially created repository from a previous failed run.

Understand the failure class

Background: "query failed", "%w: SQL error" — wrapped database query errors in Go libraries explained — this error's family across 3 libraries.

Related errors


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

Appendix: source

Thrown at engine/src/main/java/org/pentaho/di/repository/kdr/KettleDatabaseRepositoryCreationHelper.java:140

      KettleDatabaseRepository.REP_STRING_LENGTH, 0 ) );
    sql =
      database.getDDL(
        schemaTable, table, null, false, KettleDatabaseRepository.FIELD_REPOSITORY_LOG_ID_REPOSITORY_LOG,
        false );

    if ( !Utils.isEmpty( sql ) ) {
      statements.add( sql );
      if ( !dryrun ) {
        try {
          if ( log.isDetailed() ) {
            log.logDetailed( "executing SQL statements: " + Const.CR + sql );
          }
          database.execStatements( sql );
          if ( log.isDetailed() ) {
            log.logDetailed( "Created/altered table " + schemaTable );
          }
        } catch ( KettleException dbe ) {
          throw new KettleException( "Unable to create or modify table " + schemaTable, dbe );
        }
      }
    } else {
      if ( log.isDetailed() ) {
        log.logDetailed( "Table " + schemaTable + " is OK." );
      }
    }

    if ( !dryrun ) {
      repository.insertLogEntry( ( upgrade ? "Upgrade" : "Creation" ) + " of the Kettle repository" );
    }

    // ////////////////////////////////////////////////////////////////////////////////
    // R_VERSION
    //
    // Let's start with the version table
    //
    table = new RowMeta();

View on GitHub (pinned to f3058517a1)