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
- Grant CREATE/ALTER TABLE privileges to the repository database user.
- Check the nested KettleException/database error for the exact SQL failure and fix the dialect issue.
- Drop or repair the partially created repository table and re-run creation.
- 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
- Grant DDL privileges to the repository user before first connect.
- Use supported database versions/dialects only.
- Test the connection before creating the schema.
- Clean up partial schemas from failed runs.
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
- Couldn't execute SQL:
- Error while creating table
- Error while dropping table
- Unable to close insert after populating table
- UpgradeRepositoryDialog.Error.CreateUpdate
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)