pentaho/pentaho-kettle · error · InvocationTargetException
Couldn't get a result because of an error :
Error message
Couldn't get a result because of an error :
What it means
In GetTableSizeProgressDialog.run, if the SELECT COUNT(*) query (via db.getOneRow) throws a KettleException, it is rethrown as an InvocationTargetException with message 'Couldn't get a result because of an error : ' plus the exception details.
Solutions
- Inspect the InvocationTargetException cause for the underlying SQL error and address it (table name, permissions).
- Re-test the connection and retry the size calculation.
- Verify the table exists in the current schema using db.checkTableExists(tableName) before computing size.
- If COUNT(*) times out on huge tables, use approximate statistics from the database catalog instead.
Example fix
// before
long size = new GetTableSizeProgressDialog( shell, dbMeta, tableName ).openSize();
// after
if ( db.checkTableExists( tableName ) ) {
long size = new GetTableSizeProgressDialog( shell, dbMeta, tableName ).openSize();
} Defensive patterns
Strategy: try-catch
Validate before calling
// verify table exists before computing size Database db = new Database( loggingObject, dbMeta ); db.connect(); boolean exists = db.checkTableExists( tableName ); db.disconnect();
Try / catch
try {
size = new GetTableSizeProgressDialog( shell, dbMeta, tableName ).openSize();
} catch ( InvocationTargetException e ) {
logError( "Couldn't get table size: " + e.getCause(), e.getCause() );
} Prevention
- Confirm the table exists and the user can SELECT from it.
- Re-test the connection if it may have dropped.
- Use estimated statistics for huge tables to avoid slow COUNT(*).
When it happens
Trigger: Opening the table-size dialog when the count query fails: connection loss, table doesn't exist, permission denied, or driver-level SQL error.
Common situations: Checking table size in Spoon after the table was dropped; connected user lacks SELECT on the table; database unavailable or session timed out.
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
- An error occurred executing SQL:
- Couldn't execute SQL:
- Couldn't find any rows because of an error :
- Couldn't prepare statement:
- Couldn't prepare statement :
AI-assisted analysis of pentaho/pentaho-kettle@f3058517a1 (2026-09-13).
Data as JSON: /api/errors/0b5d58bb505ca4d5.
Report an issue: GitHub.
Appendix: source
Thrown at ui/src/main/java/org/pentaho/di/ui/core/database/dialog/GetTableSizeProgressDialog.java:77
}
public Long open() {
IRunnableWithProgress op = new IRunnableWithProgress() {
public void run( IProgressMonitor monitor ) throws InvocationTargetException, InterruptedException {
db = new Database( Spoon.loggingObject, dbMeta );
try {
db.connect();
String sql = dbMeta.getDatabaseInterface().getSelectCountStatement( tableName );
RowMetaAndData row = db.getOneRow( sql );
size = row.getRowMeta().getInteger( row.getData(), 0 );
if ( monitor.isCanceled() ) {
throw new InvocationTargetException( new Exception( "This operation was cancelled!" ) );
}
} catch ( KettleException e ) {
throw new InvocationTargetException( e, "Couldn't get a result because of an error :" + e.toString() );
} finally {
db.close();
}
}
};
try {
final ProgressMonitorDialog pmd = new ProgressMonitorDialog( shell );
// Run something in the background to cancel active database queries, forecably if needed!
Runnable run = new Runnable() {
public void run() {
IProgressMonitor monitor = pmd.getProgressMonitor();
while ( pmd.getShell() == null || ( !pmd.getShell().isDisposed() && !monitor.isCanceled() ) ) {
try {
Thread.sleep( 100 );
} catch ( InterruptedException e ) {
// Ignore
}View on GitHub (pinned to f3058517a1)