pentaho/pentaho-kettle · error · KettleStepException

DimensionLookupMeta.Exception.UnableToRetrieveDataTypeOfRetu…

Error message

DimensionLookupMeta.Exception.UnableToRetrieveDataTypeOfReturnField

What it means

During check(), the step looks up the data type of each return field from the table metadata. If the return field was found but its ValueMetaInterface cannot be determined (searchValueType returns null / no type info available), the localized 'Unable to retrieve data type of return field' message is thrown as a KettleStepException. This is thrown on the non-exception path — the field exists in configuration but no type metadata could be resolved for it.

Solutions

  1. Re-read the table metadata in the step dialog and re-map the return fields so types are re-resolved
  2. Verify the JDBC driver correctly reports the column types; upgrade the driver if types come back null
  3. Check the repository/database metadata integrity for the table (re-import DDL if needed)
  4. Explicitly set the expected return type in the step's return field type column instead of relying on table inference

Example fix

// before: relying on inferred (null) type for a custom column type
meta.setFieldLookup(new String[] { "attrs" });
// after: explicitly set the return type
meta.setFieldLookup(new String[] { "attrs" });
meta.setReturnType(new int[] { ValueMetaInterface.TYPE_STRING });
Defensive patterns

Strategy: validation

Validate before calling

// Java: confirm each return field resolves to a type before execution
ValueMetaInterface v = tableFields.searchValueMeta(field);
if (v == null || v.getType() == ValueMetaInterface.TYPE_NONE)
  throw new IllegalStateException("No data type resolvable for return field: " + field);

Type guard

// narrow on the resolved type
ValueMetaInterface v = row.searchValueMeta(fieldName);
if (v == null || v.getType() <= 0) throw new KettleStepException("Return field type unresolved: " + fieldName);

Try / catch

try {
  meta.getFields(row, origin, null, null, sp, metaStore);
} catch (KettleStepException e) {
  if (e.getMessage().contains("UnableToRetrieveDataTypeOfReturnField")) {
    meta.setReturnType(new int[] { ValueMetaInterface.TYPE_STRING }); // explicit fallback type
  } else throw e;
}

Prevention

When it happens

Trigger: In getFields(), the code takes the branch where the field's value meta could not be derived from the table's row metadata (e.g. dataTypes/searchValueType yields nothing for the field) and falls into the else that throws this message.

Common situations: Metadata read from a repository where column type info is unavailable; unsupported/unknown SQL type mapped to null; stale metadata after table alterations; database driver returning null type for exotic column types.

Understand the failure class

Background: Schema validation failed / invalid input schema: payload rejected because its shape doesn't match the expected schema — this error's family across 28 libraries.

Related errors


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

Appendix: source

Thrown at engine/src/main/java/org/pentaho/di/trans/steps/dimensionlookup/DimensionLookupMeta.java:804

              String message =
                  BaseMessages.getString( PKG, "DimensionLookupMeta.Exception.UnableToFindReturnField",
                      fieldLookup[i] );
              logError( message );
              throw new KettleStepException( message );
            }

            // 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 );

View on GitHub (pinned to f3058517a1)