{"record":{"id":"588cedb423b401dd","repo":"pentaho/pentaho-kettle","slug":"gpbulkloadermeta-exception-errorgettingfields-588ced","errorCode":"GPBulkLoaderMeta.Exception.ErrorGettingFields","errorMessage":"GPBulkLoaderMeta.Exception.ErrorGettingFields","messagePattern":"GPBulkLoaderMeta\\.Exception\\.ErrorGettingFields","errorType":"error_code","errorClass":"KettleException","httpStatus":null,"severity":"error","filePath":"plugins/postgresql-db-bulk-loader/impl/src/main/java/org/pentaho/di/trans/steps/pgbulkloader/PGBulkLoaderMeta.java","lineNumber":609,"sourceCode":"    if ( databaseMeta != null ) {\n      Database db = new Database( loggingObject, databaseMeta );\n      try {\n        db.connect();\n\n        if ( !Utils.isEmpty( realTableName ) ) {\n          String schemaTable = databaseMeta.getQuotedSchemaTableCombination( realSchemaName, realTableName );\n\n          // Check if this table exists...\n          if ( db.checkTableExists( schemaTable ) ) {\n            return db.getTableFields( schemaTable );\n          } else {\n            throw new KettleException( BaseMessages.getString( PKG, \"GPBulkLoaderMeta.Exception.TableNotFound\" ) );\n          }\n        } else {\n          throw new KettleException( BaseMessages.getString( PKG, \"GPBulkLoaderMeta.Exception.TableNotSpecified\" ) );\n        }\n      } catch ( Exception e ) {\n        throw new KettleException(\n          BaseMessages.getString( PKG, \"GPBulkLoaderMeta.Exception.ErrorGettingFields\" ), e );\n      } finally {\n        db.close();\n      }\n    } else {\n      throw new KettleException( BaseMessages.getString( PKG, \"GPBulkLoaderMeta.Exception.ConnectionNotDefined\" ) );\n    }\n\n  }\n\n  /**\n   * @return the schemaName\n   */\n  public String getSchemaName() {\n    return schemaName;\n  }\n\n  /**","sourceCodeStart":591,"sourceCodeEnd":627,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/plugins/postgresql-db-bulk-loader/impl/src/main/java/org/pentaho/di/trans/steps/pgbulkloader/PGBulkLoaderMeta.java#L591-L627","documentation":"getRequiredFields() wraps its whole table-introspection body (connect, checkTableExists, getTableFields) in a catch-all that rethrows as KettleException with GPBulkLoaderMeta.Exception.ErrorGettingFields and the original exception as cause. It is a generic wrapper meaning field metadata for the target table could not be retrieved; the real reason is in the cause (connection failure, SQL error, permission denied).","triggerScenarios":"Any exception inside getRequiredFields()'s try block after a connection exists: db.connect() failing (bad credentials/host), db.getTableFields() throwing on a malformed/odd table, or SQLException during metadata queries.","commonSituations":"Wrong database credentials or unreachable host for the step's connection; driver not on classpath; user lacking SELECT privilege on the target table (PostgreSQL refuses column metadata); intermittent DB outage during transformation check.","solutions":["Read the cause exception — it names the actual JDBC/SQL error; fix that root cause first.","Test the step's database connection (Test button) and fix credentials/host/port/driver.","Grant the connecting user SELECT on the target table (PostgreSQL: GRANT SELECT ON schema.table TO user;).","Retry after resolving transient network/DB outages."],"exampleFix":"// before: user cannot read table metadata\n// GRANT needed\n// after (run on PostgreSQL)\nGRANT SELECT ON staging.sales_facts TO kettle_user;","handlingStrategy":"try-catch","validationCode":"DatabaseMeta dm = meta.getDatabaseMeta();\nif ( dm != null ) { try ( Database db = new Database( loggingObject, dm ) ) { db.connect(); } } // fail fast on connectivity","typeGuard":null,"tryCatchPattern":"try { meta.getRequiredFields( transMeta ); } catch ( KettleException e ) { logError( \"Cause: \" + e.getCause(), e ); } // inspect cause for JDBC error","preventionTips":["Test the database connection from the step dialog first.","Grant SELECT on the target table to the connecting user.","Keep the JDBC driver on the classpath."],"tags":["kettle","database","metadata","wrapped-exception","pentaho"],"backgroundTag":"database-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"}