{"record":{"id":"6eabb113677c7be3","repo":"pentaho/pentaho-kettle","slug":"e-no-own-message-error-caching-lookup-rows","errorCode":null,"errorMessage":"e (no own message; error caching lookup rows)","messagePattern":"e \\(no own message; error caching lookup rows\\)","errorType":"exception","errorClass":"KettleException","httpStatus":null,"severity":"error","filePath":"engine/src/main/java/org/pentaho/di/trans/steps/databaselookup/DatabaseLookup.java","lineNumber":507,"sourceCode":"      sql.append( \" FROM \" ).append(\n        dbMeta.getQuotedSchemaTableCombination( environmentSubstitute( meta.getSchemaName() ),\n          environmentSubstitute( meta.getTablename() ) ) );\n\n      // order by?\n      if ( !Utils.isEmpty( meta.getOrderByClause() ) ) {\n        sql.append( \" ORDER BY \" ).append( meta.getOrderByClause() );\n      }\n\n      // Now that we have the SQL constructed, let's store the rows...\n      //\n\n      if ( data.allEquals ) {\n        putToDefaultCache( db, sql.toString() );\n      } else {\n        putToReadOnlyCache( db, db.getRows( sql.toString(), 0 ) );\n      }\n    } catch ( Exception e ) {\n      throw new KettleException( e );\n    }\n  }\n\n  private void putToDefaultCache( Database db, String sql ) throws KettleDatabaseException {\n    final int keysAmount = meta.getStreamKeyField1().length;\n    AtomicReference<RowMetaInterface> prototype = new AtomicReference<>();\n    AtomicBoolean firstRow = new AtomicBoolean( true );\n\n    db.forEachRow( sql, 0, row -> {\n      if ( firstRow.get() ) {\n        // Assume that all rows have the same meta; let's reuse it for all rows\n        prototype.set( copyValueMetasFrom( db.getReturnRowMeta(), keysAmount ) );\n        firstRow.set( false );\n      }\n      putRowToDefaultCache( prototype.get(), keysAmount, row );\n    } );\n  }\n","sourceCodeStart":489,"sourceCodeEnd":525,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/engine/src/main/java/org/pentaho/di/trans/steps/databaselookup/DatabaseLookup.java#L489-L525","documentation":"DatabaseLookup.loadAllTableDataIntoTheCache() preloads the whole lookup table into the cache when 'load all data from table' is enabled. Any exception from executing the SQL (db.getRows / putToDefaultCache / putToReadOnlyCache) is rethrown as a bare KettleException wrapping e, with no additional message.","triggerScenarios":"processRow() triggers a full-table cache load and the underlying SELECT against the lookup table throws — bad SQL from generated conditions, missing table, or a JDBC error.","commonSituations":"Lookup table missing/renamed in the DB; permission denied on the table; type-incompatible key comparison producing invalid SQL; DB connection dropped mid-load.","solutions":["Inspect the wrapped cause e — it is the actual KettleDatabaseException/SQLException","Verify the lookup table exists and the connection user can SELECT from it","Disable 'load all data from table' (use cached/db lookup) if the table is too large or has problematic key types","Test the generated SQL in a DB client to reproduce the error"],"exampleFix":"// before\n} catch ( Exception e ) {\n  throw new KettleException( e );\n}\n// after\n} catch ( Exception e ) {\n  throw new KettleException( BaseMessages.getString(\n    PKG, \"DatabaseLookup.ERROR0003.ErrorCachingLookupRows\" ), e ); // keep message + cause\n}","handlingStrategy":"try-catch","validationCode":"// pre-check table readability before enabling 'load all data from table'\nRowMetaInterface f = db.getTableFields( meta.getSchemaTable() );\nif ( f == null ) throw new KettleException( \"Cannot cache; table missing: \" + meta.getSchemaTable() );\nlong cnt = db.getRows( \"SELECT 1 FROM \" + meta.getSchemaTable() + \" LIMIT 1\", 1 ).size();","typeGuard":null,"tryCatchPattern":"try {\n  trans.execute(); trans.waitUntilFinished();\n} catch ( KettleException e ) {\n  Throwable root = e; while ( root.getCause() != null ) root = root.getCause(); // unwrap to real SQL error\n  logError( \"Lookup cache load failed: \" + root.getMessage(), root );\n}","preventionTips":["Unwrap the cause chain — this exception is a bare rethrow","Avoid 'load all data' on huge tables or tables with volatile availability","Confirm SELECT grants on the lookup table for the connection user","Test the generated lookup SQL directly against the DB"],"tags":["kettle","database","cache","sql"],"backgroundTag":"sql-query-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"}