{"record":{"id":"9c2e813e72ae2d39","repo":"pentaho/pentaho-kettle","slug":"synchronizeaftermergemeta-exception-errorgettingfields","errorCode":null,"errorMessage":"SynchronizeAfterMergeMeta.Exception.ErrorGettingFields","messagePattern":"SynchronizeAfterMergeMeta\\.Exception\\.ErrorGettingFields","errorType":"exception","errorClass":"KettleException","httpStatus":null,"severity":"error","filePath":"engine/src/main/java/org/pentaho/di/trans/steps/synchronizeaftermerge/SynchronizeAfterMergeMeta.java","lineNumber":1055,"sourceCode":"    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(\n              PKG, \"SynchronizeAfterMergeMeta.Exception.TableNotFound\" ) );\n          }\n        } else {\n          throw new KettleException( BaseMessages.getString(\n            PKG, \"SynchronizeAfterMergeMeta.Exception.TableNotSpecified\" ) );\n        }\n      } catch ( Exception e ) {\n        throw new KettleException( BaseMessages.getString(\n          PKG, \"SynchronizeAfterMergeMeta.Exception.ErrorGettingFields\" ), e );\n      } finally {\n        db.close();\n      }\n    } else {\n      throw new KettleException( BaseMessages.getString(\n        PKG, \"SynchronizeAfterMergeMeta.Exception.ConnectionNotDefined\" ) );\n    }\n\n  }\n\n  /**\n   * @return the schemaName\n   */\n  public String getSchemaName() {\n    return schemaName;\n  }\n","sourceCodeStart":1037,"sourceCodeEnd":1073,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/engine/src/main/java/org/pentaho/di/trans/steps/synchronizeaftermerge/SynchronizeAfterMergeMeta.java#L1037-L1073","documentation":"Wrapper error thrown by SynchronizeAfterMergeMeta.getTableFieldsMeta: any exception during the field-metadata lookup (connection issues, SQL errors, TableNotFound) is caught and rethrown as KettleException with ErrorGettingFields as the primary message and the original exception as the cause.","triggerScenarios":"Any failure inside the try block of getTableFieldsMeta — e.g. db.getTableFieldsMeta throws SQLException, or TableNotFound/TableNotSpecified was raised — gets wrapped by this message.","commonSituations":"Database unreachable during metadata lookup; table exists config-wise but missing in DB (cause is TableNotFound); wrong schema name; insufficient privileges to describe the table.","solutions":["Inspect the cause chain of the KettleException for the root error (TableNotFound, SQL error, connection failure)","Confirm the table/schema exists in the target database and the user has SELECT/DESCRIBE rights","Test the database connection in the step dialog before running","Wrap the call in try-catch and log cause.getMessage() for diagnostics"],"exampleFix":"// before\ntry { meta.getTableFieldsMeta(...); } catch (KettleException e) { log.error(e.getMessage()); }\n// after\ntry { meta.getTableFieldsMeta(...); } catch (KettleException e) { log.error(\"Root cause: \" + e.getCause(), e); }","handlingStrategy":"try-catch","validationCode":"// verify connection and table existence before lookup\nif (meta.getDatabaseMeta() == null || meta.getTablename() == null) return;\nDatabase db = new Database(transMeta, meta.getDatabaseMeta()); if (!db.checkTableExists(realSchema, realTable)) return;","typeGuard":null,"tryCatchPattern":"try { meta.getTableFieldsMeta(...); } catch (KettleException e) { logError(\"Field lookup failed, cause=\" + (e.getCause()!=null?e.getCause().getMessage():e.getMessage()), e); }","preventionTips":["Log the full cause chain, not just the top message","Test DB connection and table existence before transformation runs","Grant the DB user DESCRIBE/SELECT on the target table"],"tags":["kettle","database","metadata","wrapped-exception"],"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"}