{"record":{"id":"558e506c2e3a2a8c","repo":"pentaho/pentaho-kettle","slug":"dimensionlookupmeta-exception","errorCode":null,"errorMessage":"DimensionLookupMeta.Exception.UnableToRetrieveDataTypeOfReturnField","messagePattern":"DimensionLookupMeta\\.Exception\\.UnableToRetrieveDataTypeOfReturnField","errorType":"exception","errorClass":"KettleStepException","httpStatus":null,"severity":"error","filePath":"engine/src/main/java/org/pentaho/di/trans/steps/dimensionlookup/DimensionLookupMeta.java","lineNumber":804,"sourceCode":"              String message =\n                  BaseMessages.getString( PKG, \"DimensionLookupMeta.Exception.UnableToFindReturnField\",\n                      fieldLookup[i] );\n              logError( message );\n              throw new KettleStepException( message );\n            }\n\n            // If the field needs to be renamed, rename\n            if ( fieldStream[i] != null && fieldStream[i].length() > 0 ) {\n              v.setName( fieldStream[i] );\n            }\n            v.setOrigin( name );\n            row.addValueMeta( v );\n          }\n        } else {\n          String message =\n              BaseMessages.getString( PKG, \"DimensionLookupMeta.Exception.UnableToRetrieveDataTypeOfReturnField\" );\n          logError( message );\n          throw new KettleStepException( message );\n        }\n      } catch ( Exception e ) {\n        String message =\n            BaseMessages.getString( PKG, \"DimensionLookupMeta.Exception.UnableToRetrieveDataTypeOfReturnField2\" );\n        logError( message );\n        throw new KettleStepException( message, e );\n      } finally {\n        if ( db != null ) {\n          db.close();\n        }\n      }\n    }\n  }\n\n  @Override\n  public String getXML() {\n    actualizeWithInjectedValues();\n    StringBuilder retval = new StringBuilder( 512 );","sourceCodeStart":786,"sourceCodeEnd":822,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/engine/src/main/java/org/pentaho/di/trans/steps/dimensionlookup/DimensionLookupMeta.java#L786-L822","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Re-read the table metadata in the step dialog and re-map the return fields so types are re-resolved","Verify the JDBC driver correctly reports the column types; upgrade the driver if types come back null","Check the repository/database metadata integrity for the table (re-import DDL if needed)","Explicitly set the expected return type in the step's return field type column instead of relying on table inference"],"exampleFix":"// before: relying on inferred (null) type for a custom column type\nmeta.setFieldLookup(new String[] { \"attrs\" });\n// after: explicitly set the return type\nmeta.setFieldLookup(new String[] { \"attrs\" });\nmeta.setReturnType(new int[] { ValueMetaInterface.TYPE_STRING });","handlingStrategy":"validation","validationCode":"// Java: confirm each return field resolves to a type before execution\nValueMetaInterface v = tableFields.searchValueMeta(field);\nif (v == null || v.getType() == ValueMetaInterface.TYPE_NONE)\n  throw new IllegalStateException(\"No data type resolvable for return field: \" + field);","typeGuard":"// narrow on the resolved type\nValueMetaInterface v = row.searchValueMeta(fieldName);\nif (v == null || v.getType() <= 0) throw new KettleStepException(\"Return field type unresolved: \" + fieldName);","tryCatchPattern":"try {\n  meta.getFields(row, origin, null, null, sp, metaStore);\n} catch (KettleStepException e) {\n  if (e.getMessage().contains(\"UnableToRetrieveDataTypeOfReturnField\")) {\n    meta.setReturnType(new int[] { ValueMetaInterface.TYPE_STRING }); // explicit fallback type\n  } else throw e;\n}","preventionTips":["Set the return field type explicitly in the step rather than relying on inference","Verify the JDBC driver reports column types correctly (test with a metadata query)","Re-read table metadata after altering column types","Avoid exotic/custom column types for dimension attributes"],"tags":["configuration","data-type","metadata","dimension-lookup"],"backgroundTag":"schema-validation-failed","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"}