{"record":{"id":"138ccd03e67913a5","repo":"pentaho/pentaho-kettle","slug":"insertupdatemeta-exception-tablenotfound","errorCode":null,"errorMessage":"InsertUpdateMeta.Exception.TableNotFound","messagePattern":"InsertUpdateMeta\\.Exception\\.TableNotFound","errorType":"exception","errorClass":"KettleException","httpStatus":null,"severity":"error","filePath":"engine/src/main/java/org/pentaho/di/trans/steps/insertupdate/InsertUpdateMeta.java","lineNumber":812,"sourceCode":"  public void setUpdateBypassed( boolean updateBypassed ) {\n    this.updateBypassed = updateBypassed;\n  }\n\n  public RowMetaInterface getRequiredFields( VariableSpace space ) throws KettleException {\n    String realSchemaName = space.environmentSubstitute( schemaName );\n    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","sourceCodeStart":794,"sourceCodeEnd":830,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/engine/src/main/java/org/pentaho/di/trans/steps/insertupdate/InsertUpdateMeta.java#L794-L830","documentation":"The step's table field lookup verified the target table's existence and the table was not found in the database (after substituting variables for schema/table names). Thrown as KettleException with the TableNotFound message, typically while retrieving field metadata for the UI mapping.","triggerScenarios":"db.checkTableExists(realSchemaName, realTableName) returned false because the table doesn't exist, the schema is wrong, ${...} variables resolved to unexpected values, or the connection points to a different database.","commonSituations":"Typo in table name; ${TABLENAME} variable unset or resolving empty; connected to dev DB instead of prod; case-sensitive DB (PostgreSQL/Oracle) with mismatched identifier case; missing schema prefix.","solutions":["Create the target table in the database, or correct the Table name in the step settings.","Verify the schema name and that the connection points to the intended database (Test connection).","Check variable values used in schema/table names — set them in transformation properties.","Match identifier case/quoting for case-sensitive databases."],"exampleFix":"// before: variable unresolved leads to wrong table lookup\nmeta.setTableName(\"${TARGET_TABLE}\"); // variable missing\n// after: set variable\ntransMeta.setVariable(\"TARGET_TABLE\", \"customer\");","handlingStrategy":"validation","validationCode":"Database db = new Database(transMeta, meta.getDatabaseMeta());\ndb.connect();\nString schema = transMeta.environmentSubstitute(meta.getSchemaName());\nString table = transMeta.environmentSubstitute(meta.getTableName());\nif (!db.checkTableExists(schema, table))\n  throw new IllegalStateException(\"Table not found: \" + schema + \".\" + table);","typeGuard":"null","tryCatchPattern":"try { RowMetaInterface fields = meta.getTableFields(); }\ncatch (KettleException e) {\n  if (e.getMessage().contains(\"TableNotFound\")) { /* create table or fix name/variable */ }\n  throw e;\n}","preventionTips":["Resolve all ${variables} used in schema/table names before fetching field metadata.","Verify the connection targets the intended environment (dev vs prod).","Mind identifier case/quoting on case-sensitive databases (Oracle, PostgreSQL).","Create target tables (SQL button or DDL scripts) before configuring field mapping."],"tags":["kettle","pdi","table-not-found","database"],"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"}