{"record":{"id":"d694eb743b27523a","repo":"pentaho/pentaho-kettle","slug":"synchronizeaftermergemeta-exception-tablenotfound","errorCode":null,"errorMessage":"SynchronizeAfterMergeMeta.Exception.TableNotFound","messagePattern":"SynchronizeAfterMergeMeta\\.Exception\\.TableNotFound","errorType":"exception","errorClass":"KettleException","httpStatus":null,"severity":"error","filePath":"engine/src/main/java/org/pentaho/di/trans/steps/synchronizeaftermerge/SynchronizeAfterMergeMeta.java","lineNumber":1047,"sourceCode":"      return super.getUsedDatabaseConnections();\n    }\n  }\n\n  public RowMetaInterface getRequiredFields( VariableSpace space ) throws KettleException {\n    String realTableName = space.environmentSubstitute( tableName );\n    String realSchemaName = space.environmentSubstitute( schemaName );\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(\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  }","sourceCodeStart":1029,"sourceCodeEnd":1065,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/engine/src/main/java/org/pentaho/di/trans/steps/synchronizeaftermerge/SynchronizeAfterMergeMeta.java#L1029-L1065","documentation":"During validation the step connects to the target database and, when the real (schema-qualified) table name is non-empty, calls db.checkTableExists(). If the table does not exist it throws KettleException 'TableNotFound' instead of proceeding to read its field metadata via getTableFieldsMeta.","triggerScenarios":"The configured target table (and schema) does not exist in the connected database at validation time — wrong connection selected, wrong schema name, table dropped, or table name resolved from a table-name-in-field variable that evaluates incorrectly.","commonSituations":"Pointing the transformation at a dev/test database missing the table; schema not set so lookup goes to the wrong default schema; typo in table name; migration not yet run in the target environment.","solutions":["Create the target table in the database (or run the migration) before executing/validating the transformation","Verify the step's database connection points at the intended environment and schema","Fix the table name (and schema name) in the step dialog; check any variable used for the table name resolves correctly","If the table name comes from a field/variable, ensure the value is correct at validation time and the connection user can see the table (grants/synonyms)"],"exampleFix":"// before: table ORDERS missing in schema SALES\nSQL> CREATE TABLE SALES.ORDERS (ORDER_ID NUMBER, AMOUNT NUMBER(10,2), ...);\n// or fix step config: target schema.table = SALES.ORDERS (was PUBLIC.ORDRS)","handlingStrategy":"validation","validationCode":"// Before running/validating, confirm the table exists\nDatabaseMeta dbMeta = transMeta.findDatabaseConnection(\"MY_CONN\");\nDatabase db = new Database(loggingObject, dbMeta);\ndb.connect();\nif (!db.checkTableExists(schema, tableName)) {\n  throw new IllegalStateException(\"Target table missing: \" + schema + \".\" + tableName);\n}\ndb.disconnect();","typeGuard":null,"tryCatchPattern":"try { trans.execute(...); }\ncatch (KettleException e) { if (e.getMessage().contains(\"TableNotFound\")) { log.error(\"Create/locate table before running: \" + schema + \".\" + table); } else throw e; }","preventionTips":["Run schema migrations before deploying transformations","Verify the database connection points at the right environment","Qualify tables with explicit schema names","Check variables used for table names resolve correctly in each environment"],"tags":["kettle","database","table-not-found","validation"],"backgroundTag":"entity-not-found","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"}