pentaho/pentaho-kettle · error · KettleException

SQLFileOutputMeta.Exception.TableNotSpecified

SQLFileOutputMeta.Exception.TableNotSpecified

Error message

SQLFileOutputMeta.Exception.TableNotSpecified

What it means

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.

Solutions

  1. Enter a concrete target table name in the step dialog before using Get Fields
  2. Define the ${TABLE} variable in the Spoon session (Ctrl+L / kettle.properties) so substitution yields a non-empty value
  3. Set both Schema and Table fields explicitly and re-open the dialog to confirm they persisted

Example fix

// before
meta.setTablename( "${TABLE}" ); // variable undefined -> empty
// after (define the variable in kettle.properties)
TABLE=DIM_CUSTOMER
// or set a literal
meta.setTablename( "DIM_CUSTOMER" );
Defensive patterns

Strategy: validation

Validate before calling

String realTable = space.environmentSubstitute( meta.getTablename() );
if ( realTable == null || realTable.trim().isEmpty() ) {
  throw new IllegalStateException( "SQL File Output: target table not specified (check ${TABLE} variable value)" );
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Understand the failure class

Background: "must not be empty", "cannot be empty" — required-field validation errors across open-source libraries — this error's family across 41 libraries.

Related errors


AI-assisted analysis of pentaho/pentaho-kettle@f3058517a1 (2026-09-13). Data as JSON: /api/errors/d6a3001451ef7ddb. Report an issue: GitHub.

Appendix: source

Thrown at engine/src/main/java/org/pentaho/di/trans/steps/sqlfileoutput/SQLFileOutputMeta.java:808

  public RowMetaInterface getRequiredFields( VariableSpace space ) throws KettleException {
    String realTableName = space.environmentSubstitute( tablename );
    String realSchemaName = space.environmentSubstitute( schemaName );

    if ( databaseMeta != null ) {
      Database db = new Database( loggingObject, databaseMeta );
      try {
        db.connect();

        if ( !Utils.isEmpty( realTableName ) ) {
          // Check if this table exists...
          if ( db.checkTableExists( realSchemaName, realTableName ) ) {
            return db.getTableFieldsMeta( realSchemaName, realTableName );
          } else {
            throw new KettleException( BaseMessages.getString( PKG, "SQLFileOutputMeta.Exception.TableNotFound" ) );
          }
        } else {
          throw new KettleException( BaseMessages.getString( PKG, "SQLFileOutputMeta.Exception.TableNotSpecified" ) );
        }
      } catch ( Exception e ) {
        throw new KettleException(
          BaseMessages.getString( PKG, "SQLFileOutputMeta.Exception.ErrorGettingFields" ), e );
      } finally {
        db.close();
      }
    } else {
      throw new KettleException( BaseMessages.getString( PKG, "SQLFileOutputMeta.Exception.ConnectionNotDefined" ) );
    }
  }

  public DatabaseMeta[] getUsedDatabaseConnections() {
    if ( databaseMeta != null ) {
      return new DatabaseMeta[] { databaseMeta };
    } else {
      return super.getUsedDatabaseConnections();
    }

View on GitHub (pinned to f3058517a1)