pentaho/pentaho-kettle · error · KettleStepException
DimensionLookupMeta.Exception.UnableToRetrieveDataTypeOfRetu…
Error message
DimensionLookupMeta.Exception.UnableToRetrieveDataTypeOfReturnField2
What it means
This is the exception-path companion of the previous error: inside getFields()' try block, any Exception while reading the table's fields/data types from the database (connecting, reading table metadata, deriving types) results in the localized 'Unable to retrieve data type of return field (2)' message wrapped with the cause in a KettleStepException. It means the step could not complete metadata retrieval from the database to determine return-field types.
Solutions
- Check the wrapped cause (getCause()) — it usually reveals a connection, authentication, or 'table not found' error
- Verify the database connection defined in the transformation works (test the connection in Spoon)
- Confirm the schema/table name configured in the step exists and the user can read its metadata
- Ensure the correct JDBC driver is on the classpath for the connection type
Example fix
// before: connection points at dev DB where the dim table doesn't exist
// after: fix the connection's host/database so table metadata can be read
DatabaseMeta dbMeta = new DatabaseMeta("dimdb", "POSTGRESQL", "Native", "user", "pass", "prod-host:5432", "warehouse", null); Defensive patterns
Strategy: try-catch
Validate before calling
// Java: verify the design-time DB connection can read table metadata before calling getFields
Database db = new Database(transMeta, databaseMeta);
try { db.connect(); db.getTableFields(schemaTable); }
finally { db.disconnect(); } Try / catch
try {
meta.getFields(row, origin, null, null, sp, metaStore);
} catch (KettleStepException e) {
if (e.getMessage().contains("UnableToRetrieveDataTypeOfReturnField2") && e.getCause() != null) {
logError("Metadata read failed: " + e.getCause().getMessage()); // connection/table/driver issue
// test/repair the connection, then retry
} else throw e;
} Prevention
- Test the database connection in Spoon before opening/editing dimension steps
- Confirm table and schema names exist and are readable by the user
- Keep the JDBC driver jar on the classpath for the connection type
- Read the cause chain — this error always wraps the real failure
When it happens
Trigger: getFields() opens a temporary database connection (db = new Database(...); db.connect()) and reads the table's row metadata; any exception (connection failure, bad table name, driver error) inside the try is caught and rethrown with this message; the connection is closed in finally.
Common situations: Database unreachable or credentials wrong at design time; table/schema name misspelled so metadata reads fail; driver class missing on the classpath; permissions prevent reading table metadata.
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
- Database.Exception.EmptyConnectionError
- MonetDBBulkLoaderMeta.Exception.ErrorGettingFields
- Database connection not found:
- Database.Exception.UnableToGetMetadata
- Database type not found!
AI-assisted analysis of pentaho/pentaho-kettle@f3058517a1 (2026-09-13).
Data as JSON: /api/errors/700eed035d91191a.
Report an issue: GitHub.
Appendix: source
Thrown at engine/src/main/java/org/pentaho/di/trans/steps/dimensionlookup/DimensionLookupMeta.java:810
// If the field needs to be renamed, rename
if ( fieldStream[i] != null && fieldStream[i].length() > 0 ) {
v.setName( fieldStream[i] );
}
v.setOrigin( name );
row.addValueMeta( v );
}
} else {
String message =
BaseMessages.getString( PKG, "DimensionLookupMeta.Exception.UnableToRetrieveDataTypeOfReturnField" );
logError( message );
throw new KettleStepException( message );
}
} catch ( Exception e ) {
String message =
BaseMessages.getString( PKG, "DimensionLookupMeta.Exception.UnableToRetrieveDataTypeOfReturnField2" );
logError( message );
throw new KettleStepException( message, e );
} finally {
if ( db != null ) {
db.close();
}
}
}
}
@Override
public String getXML() {
actualizeWithInjectedValues();
StringBuilder retval = new StringBuilder( 512 );
retval.append( " " ).append( XMLHandler.addTagValue( "schema", schemaName ) );
retval.append( " " ).append( XMLHandler.addTagValue( "table", tableName ) );
retval.append( " " ).append( XMLHandler.addTagValue( "connection", databaseMeta == null ? "" : databaseMeta
.getName() ) );
retval.append( " " ).append( XMLHandler.addTagValue( "commit", commitSize ) );View on GitHub (pinned to f3058517a1)