{"record":{"id":"832195ce1bb3ee77","repo":"pentaho/pentaho-kettle","slug":"couldn-t-find-any-rows-because-of-an-error","errorCode":null,"errorMessage":"Couldn't find any rows because of an error :","messagePattern":"Couldn't find any rows because of an error :","errorType":"exception","errorClass":"InvocationTargetException","httpStatus":null,"severity":"error","filePath":"ui/src/main/java/org/pentaho/di/ui/core/database/dialog/GetPreviewTableProgressDialog.java","lineNumber":77,"sourceCode":"    this.tableName = dbInfo.getQuotedSchemaTableCombination( schemaName, tableName );\n    this.limit = limit;\n  }\n\n  public List<Object[]> open() {\n    IRunnableWithProgress op = new IRunnableWithProgress() {\n      public void run( IProgressMonitor monitor ) throws InvocationTargetException, InterruptedException {\n        db = new Database( Spoon.loggingObject, dbMeta );\n        try {\n          db.connect();\n\n          if ( limit > 0 ) {\n            db.setQueryLimit( limit );\n          }\n\n          rows = db.getFirstRows( tableName, limit, new ProgressMonitorAdapter( monitor ) );\n          rowMeta = db.getReturnRowMeta();\n        } catch ( KettleException e ) {\n          throw new InvocationTargetException( e, \"Couldn't find any rows because of an error :\" + e.toString() );\n        } finally {\n          db.close();\n        }\n      }\n    };\n\n    try {\n      final ProgressMonitorDialog pmd = new ProgressMonitorDialog( shell );\n      // Run something in the background to cancel active database queries, forecably if needed!\n      Runnable run = new Runnable() {\n        public void run() {\n          IProgressMonitor monitor = pmd.getProgressMonitor();\n          while ( pmd.getShell() == null || ( !pmd.getShell().isDisposed() && !monitor.isCanceled() ) ) {\n            try {\n              Thread.sleep( 100 );\n            } catch ( InterruptedException e ) {\n              // Ignore\n            }","sourceCodeStart":59,"sourceCodeEnd":95,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/ui/src/main/java/org/pentaho/di/ui/core/database/dialog/GetPreviewTableProgressDialog.java#L59-L95","documentation":"GetPreviewTableProgressDialog runs db.getFirstRows(tableName, limit, monitor) in a background thread to preview a table's rows. If a KettleException is thrown while querying, it is wrapped in an InvocationTargetException with the message 'Couldn't find any rows because of an error : ' plus the exception details.","triggerScenarios":"Opening the table preview dialog when the SQL select against the table fails: bad table name, dropped table, connection loss, or driver-level SQL error inside getFirstRows().","commonSituations":"Previewing a table after it was renamed/dropped by another user; previewing tables in a schema the connected user cannot read; network interruption during preview in Spoon's 'Preview' / 'Browse tables' feature.","solutions":["Inspect the cause of the InvocationTargetException for the underlying SQL error and correct the table name/schema.","Verify the table still exists and the connected user has SELECT privileges on it.","Reconnect (test the DatabaseMeta connection) and retry the preview.","If the preview consistently fails with large tables, reduce the preview row limit."],"exampleFix":"// before\nrows = db.getFirstRows( tableName, limit, new ProgressMonitorAdapter( monitor ) );\n// after\nif ( db.checkTableExists( tableName ) ) {\n  rows = db.getFirstRows( tableName, limit, new ProgressMonitorAdapter( monitor ) );\n}","handlingStrategy":"try-catch","validationCode":"// confirm table exists before preview\nDatabase db = new Database( loggingObject, dbMeta );\ndb.connect();\nboolean exists = db.checkTableExists( tableName );\ndb.disconnect();","typeGuard":null,"tryCatchPattern":"try {\n  rows = new GetPreviewTableProgressDialog( shell, loggingObject, dbMeta, tableName ).open();\n} catch ( InvocationTargetException e ) {\n  logError( \"Preview failed: \" + e.getCause(), e.getCause() );\n}","preventionTips":["Verify the table name/schema exists before previewing.","Confirm the connected user has SELECT privileges.","Refresh the connection if it may have timed out."],"tags":["jdbc","database","preview","sql"],"backgroundTag":"empty-result-set","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"}