{"record":{"id":"4a23eb1423492550","repo":"pentaho/pentaho-kettle","slug":"tableoutputmeta-exception-tablenotfound","errorCode":"TableOutputMeta.Exception.TableNotFound","errorMessage":"TableOutputMeta.Exception.TableNotFound","messagePattern":"TableOutputMeta\\.Exception\\.TableNotFound","errorType":"exception","errorClass":"KettleException","httpStatus":null,"severity":"error","filePath":"engine/src/main/java/org/pentaho/di/trans/steps/tableoutput/TableOutputMeta.java","lineNumber":917,"sourceCode":"\n    return retval;\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( PKG, \"TableOutputMeta.Exception.TableNotFound\" ) );\n          }\n        } else {\n          throw new KettleException( BaseMessages.getString( PKG, \"TableOutputMeta.Exception.TableNotSpecified\" ) );\n        }\n      } catch ( Exception e ) {\n        throw new KettleException(\n          BaseMessages.getString( PKG, \"TableOutputMeta.Exception.ErrorGettingFields\" ), e );\n      } finally {\n        db.close();\n      }\n    } else {\n      throw new KettleException( BaseMessages.getString( PKG, \"TableOutputMeta.Exception.ConnectionNotDefined\" ) );\n    }\n\n  }\n\n  public DatabaseMeta[] getUsedDatabaseConnections() {\n    if ( databaseMeta != null ) {","sourceCodeStart":899,"sourceCodeEnd":935,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/engine/src/main/java/org/pentaho/di/trans/steps/tableoutput/TableOutputMeta.java#L899-L935","documentation":"Thrown (via TableOutputMeta, in the code path that returns the target table's field metadata) when the configured physical table does not exist in the database. Before building the output row layout, the step verifies the real schema/table with db.checkTableExists; if absent it raises this keyed KettleException rather than attempting inserts against a missing table.","triggerScenarios":"Calling getTableFields()/getFields flow on TableOutputMeta when databaseMeta is set, realTableName (variables resolved) is non-empty, but db.checkTableExists(realSchemaName, realTableName) returns false.","commonSituations":"Typo in table name; table lives in a different schema than realSchemaName; variables like ${TABLENAME} resolve to the wrong value at runtime; table was dropped or the step is connected to the wrong database environment (dev vs prod).","solutions":["Create the table in the database or run SQL to generate it (Table Output > SQL button generates DDL).","Verify the table name and schema in the step dialog, including any variable values that will be substituted at runtime.","Confirm the database connection points at the intended environment/catalog.","Check user permissions — some databases report tables as absent when the user cannot see the schema."],"exampleFix":"// before (table not created yet)\nString tableName = \"${TARGET_TABLE}\"; // resolves to nonexistent table\n// after: pre-create table or use the SQL button generated DDL\nCREATE TABLE target_table (id BIGINT, name VARCHAR(100));","handlingStrategy":"validation","validationCode":"// check table exists before running the transformation\nDatabase db = new Database(loggingObject, meta.getDatabaseMeta(dbVars));\ndb.connect();\nif (!db.checkTableExists(schema, tableName)) {\n  throw new IllegalStateException(\"Target table missing: \" + schema + \".\" + tableName);\n}\ndb.disconnect();","typeGuard":null,"tryCatchPattern":"try { fields = meta.getTableFields(); }\ncatch (KettleException e) {\n  if (e.getMessage().contains(\"TableNotFound\")) { /* generate DDL or fix name */ }\n  else throw e;\n}","preventionTips":["Use the SQL button in Table Output to generate and review DDL","Resolve variables explicitly in logs to verify runtime table names","Point connections at the correct environment before running"],"tags":["kettle","table-output","database","missing-table"],"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"}