pentaho/pentaho-kettle · error · KettleException

SQLFileOutputMeta.Exception.ErrorGettingFields

SQLFileOutputMeta.Exception.ErrorGettingFields

Error message

SQLFileOutputMeta.Exception.ErrorGettingFields

What it means

The table-fields lookup in SQLFileOutputMeta wraps its whole body in try/catch: any exception during connect, checkTableExists or getTableFieldsMeta is rethrown as KettleException 'SQLFileOutputMeta.Exception.ErrorGettingFields' with the original exception chained. It is a generic wrapper meaning 'could not read the target table's field metadata', with the root cause in the cause chain.

Solutions

  1. Inspect the chained cause exception for the real JDBC/SQL error and fix that root problem
  2. Test the database connection from the step dialog / connection explorer (Test button)
  3. Ensure the correct JDBC driver jar is installed in PDI's lib folder
  4. Confirm network/VPN connectivity and credentials, then retry Get Fields

Example fix

// before: MySQL driver missing -> ClassNotFoundException wrapped as ErrorGettingFields
// lib/ contains only postgresql-42.x.jar
// after: add the driver
cp mysql-connector-j-8.x.jar /data-integration/lib/
// then restart Spoon and re-run Get Fields
Defensive patterns

Strategy: try-catch

Validate before calling

// Pre-check connection before field lookup:
Database db = new Database( parent, meta.getDatabaseMeta() );
try {
  db.connect();
} catch ( KettleDatabaseException e ) {
  throw new IllegalStateException( "Connection test failed: " + e.getMessage() );
} finally { db.disconnect(); }

Try / catch

try {
  RowMetaInterface fields = meta.getTableFields();
} catch ( KettleException e ) {
  log.error( "ErrorGettingFields root cause: {}", e.getCause() ); // inspect the JDBC cause
}

Prevention

When it happens

Trigger: Any failure inside the lookup: JDBC connection failure (wrong host/port/credentials), driver class not on the classpath, SQL error while querying table metadata (checkTableExists/getTableFieldsMeta), network timeouts, or one of the TableNotFound/TableNotSpecified exceptions being wrapped.

Common situations: Database firewall blocking the designer host; missing JDBC driver jar in lib/; wrong password after rotation; DB briefly down; Oracle ORA- errors surfacing through the wrapper; VPN not connected when opening Spoon.

Understand the failure class

Background: Database query failed: Internal Server Error 500s wrapping SQL, Prisma, and connection failures — what to check first — this error's family across 16 libraries.

Related errors


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

Appendix: source

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

    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)