{"record":{"id":"d6a3001451ef7ddb","repo":"pentaho/pentaho-kettle","slug":"sqlfileoutputmeta-exception-tablenotspecified","errorCode":"SQLFileOutputMeta.Exception.TableNotSpecified","errorMessage":"SQLFileOutputMeta.Exception.TableNotSpecified","messagePattern":"SQLFileOutputMeta\\.Exception\\.TableNotSpecified","errorType":"exception","errorClass":"KettleException","httpStatus":null,"severity":"error","filePath":"engine/src/main/java/org/pentaho/di/trans/steps/sqlfileoutput/SQLFileOutputMeta.java","lineNumber":808,"sourceCode":"\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, \"SQLFileOutputMeta.Exception.TableNotFound\" ) );\n          }\n        } else {\n          throw new KettleException( BaseMessages.getString( PKG, \"SQLFileOutputMeta.Exception.TableNotSpecified\" ) );\n        }\n      } catch ( Exception e ) {\n        throw new KettleException(\n          BaseMessages.getString( PKG, \"SQLFileOutputMeta.Exception.ErrorGettingFields\" ), e );\n      } finally {\n        db.close();\n      }\n    } else {\n      throw new KettleException( BaseMessages.getString( PKG, \"SQLFileOutputMeta.Exception.ConnectionNotDefined\" ) );\n    }\n  }\n\n  public DatabaseMeta[] getUsedDatabaseConnections() {\n    if ( databaseMeta != null ) {\n      return new DatabaseMeta[] { databaseMeta };\n    } else {\n      return super.getUsedDatabaseConnections();\n    }","sourceCodeStart":790,"sourceCodeEnd":826,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/engine/src/main/java/org/pentaho/di/trans/steps/sqlfileoutput/SQLFileOutputMeta.java#L790-L826","documentation":"In the same table-fields lookup path of SQLFileOutputMeta, when the real (variable-substituted) target table name is empty the code throws KettleException 'SQLFileOutputMeta.Exception.TableNotSpecified' instead of attempting a database check. Unlike error 2190 (runtime init), this fires at design time when resolving fields via getTableFieldsMeta.","triggerScenarios":"Clicking 'Get Fields'/SQL generation in the SQL File Output dialog while the 'Target table' field is blank, or contains a variable such as ${TABLE} that resolves to empty in the current variable space.","commonSituations":"Configuring the step top-to-bottom and pressing Get Fields before entering the table name; importing/saving metadata where tablename defaulted to \"\" (see setDefault); variable defined only at runtime, not in the Spoon session.","solutions":["Enter a concrete target table name in the step dialog before using Get Fields","Define the ${TABLE} variable in the Spoon session (Ctrl+L / kettle.properties) so substitution yields a non-empty value","Set both Schema and Table fields explicitly and re-open the dialog to confirm they persisted"],"exampleFix":"// before\nmeta.setTablename( \"${TABLE}\" ); // variable undefined -> empty\n// after (define the variable in kettle.properties)\nTABLE=DIM_CUSTOMER\n// or set a literal\nmeta.setTablename( \"DIM_CUSTOMER\" );","handlingStrategy":"validation","validationCode":"String realTable = space.environmentSubstitute( meta.getTablename() );\nif ( realTable == null || realTable.trim().isEmpty() ) {\n  throw new IllegalStateException( \"SQL File Output: target table not specified (check ${TABLE} variable value)\" );\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Fill in Target table before pressing Get Fields","Define variables in kettle.properties so they resolve in both Spoon and runtime","Leave tablename as \"\" only intentionally with setDefault, never at save time"],"tags":["kettle","pentaho","configuration","sql","design-time"],"backgroundTag":"empty-required-field","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"}