{"record":{"id":"153c77ea04328825","repo":"pentaho/pentaho-kettle","slug":"insertupdatemeta-exception-errorgettingfields","errorCode":null,"errorMessage":"InsertUpdateMeta.Exception.ErrorGettingFields","messagePattern":"InsertUpdateMeta\\.Exception\\.ErrorGettingFields","errorType":"exception","errorClass":"KettleException","httpStatus":null,"severity":"error","filePath":"engine/src/main/java/org/pentaho/di/trans/steps/insertupdate/InsertUpdateMeta.java","lineNumber":818,"sourceCode":"    String realTableName = space.environmentSubstitute( tableName );\n\n    if ( databaseMeta != null ) {\n      Database db = new Database( loggingObject, databaseMeta );\n      try {\n        db.connect();\n\n        if ( !Utils.isEmpty( realTableName ) ) {\n          // Check if this table exists...\n          if ( db.checkTableExists( realSchemaName, realTableName ) ) {\n            return db.getTableFieldsMeta( realSchemaName, realTableName );\n          } else {\n            throw new KettleException( BaseMessages.getString( PKG, \"InsertUpdateMeta.Exception.TableNotFound\" ) );\n          }\n        } else {\n          throw new KettleException( BaseMessages.getString( PKG, \"InsertUpdateMeta.Exception.TableNotSpecified\" ) );\n        }\n      } catch ( Exception e ) {\n        throw new KettleException(\n          BaseMessages.getString( PKG, \"InsertUpdateMeta.Exception.ErrorGettingFields\" ), e );\n      } finally {\n        db.close();\n      }\n    } else {\n      throw new KettleException( BaseMessages.getString( PKG, \"InsertUpdateMeta.Exception.ConnectionNotDefined\" ) );\n    }\n\n  }\n\n  /**\n   * @return the schemaName\n   */\n  public String getSchemaName() {\n    return schemaName;\n  }\n\n  @Override public String getMissingDatabaseConnectionInformationMessage() {","sourceCodeStart":800,"sourceCodeEnd":836,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/engine/src/main/java/org/pentaho/di/trans/steps/insertupdate/InsertUpdateMeta.java#L800-L836","documentation":"Thrown by InsertUpdateMeta.getTableFields() as the wrapping error when any exception occurs while reading the target table's field metadata (e.g. the table does not exist, or the JDBC metadata call fails). It preserves the original exception as the cause. It is the generic failure path of the fields lookup.","triggerScenarios":"getTableFields() invoked with a valid connection and table name, but checkTableExists/getTableFieldsMeta throws: the table does not exist (inner TableNotFound), bad credentials, network failure, or insufficient privileges.","commonSituations":"Running the transformation before the target table was created; pointing at a different schema/environment (test vs prod); database user lacking SELECT on the table; DB temporarily unreachable.","solutions":["Inspect the cause chain (getCause()) to see the real JDBC error.","Verify the table exists in the configured schema (or add a 'Create table' / SQL step before the transformation).","Check the database connection details (host, port, user, password, database) in the connection dialog.","Grant the DB user SELECT privileges on the target schema/table."],"exampleFix":"// before: running transform on empty database\n// after: create the table first via a 'Execute SQL script' step:\nCREATE TABLE PUBLIC.CUSTOMERS (ID BIGINT PRIMARY KEY, NAME VARCHAR(100));","handlingStrategy":"try-catch","validationCode":"// Pre-flight: confirm connectivity and table existence\nDatabaseMeta dbMeta = meta.getDatabaseMeta();\nDatabase db = new Database(parent, dbMeta);\ndb.connect();\nif (!db.checkTableExists(schema, table)) throw new IllegalStateException(\"Table missing: \" + table);","typeGuard":null,"tryCatchPattern":"try { db.getTableFields(schema, table); } catch (KettleException e) { logError(\"Field lookup failed: \" + e.getCause(), e); throw e; }","preventionTips":["Test the database connection in the dialog before saving.","Create target tables with a DDL/SQL step earlier in the job.","Grant the runtime DB user SELECT on the target schema."],"tags":["kettle","database","metadata"],"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"}