pentaho/pentaho-kettle · error · KettleConfigException
Unable to get value for expression
Error message
Unable to get value for expression [<expression>] with Ognl
What it means
After successfully compiling an OGNL expression, setOgnlProperty evaluates it via expr.getValue(ognlContext, this). This error is thrown when the expression is syntactically valid but fails during evaluation (OgnlException at getValue time), e.g. it references a null object, an inaccessible method, or a nonexistent property on the target.
Solutions
- Fix the expression so it only navigates non-null, existing properties/methods of the target object.
- Add null-safe navigation in the OGNL expression where supported, or ensure the target object is fully initialized before setProperty runs.
- Test the same expression with ognl.Ognl.getValue(expr, context, target) outside the config pipeline to reproduce and debug.
- Catch KettleConfigException around config application and log the expression plus target object state.
Example fix
// before propertySetter.setProperty(obj, "dir", "ognl:user.homeDir.path"); // homeDir may be null // after propertySetter.setProperty(obj, "dir", "ognl:user.homeDir != null ? user.homeDir.path : '/tmp'");
Defensive patterns
Strategy: try-catch
Validate before calling
Object probe = org.apache.commons.ognl.Ognl.getValue( org.apache.commons.ognl.Ognl.parseExpression(expr), ctx, target); // fails fast outside config load
Try / catch
try {
propertySetter.setProperty(obj, property, "ognl:" + expr);
} catch (KettleConfigException e) {
LOG.error("OGNL evaluation failed for expression [" + expr + "] on " + obj.getClass(), e);
} Prevention
- Ensure referenced getters exist and are public on the target object.
- Guard OGNL navigation chains against nulls.
- Re-validate expressions after refactoring the target object model.
When it happens
Trigger: setProperty(obj, property, "ognl:objRef.someMethod()") where evaluation throws — invoking a method on null, calling a missing method, or triggering an exception inside the OGNL navigation chain.
Common situations: OGNL expressions referencing properties that are null at config-apply time; expressions written against an older object model whose getters no longer exist; security-restricted method invocation failures at runtime.
Related errors
- the ognl, directive need at least 2 parameters: ongl and…
- Unable to parse expression
- A connection of type PALO is expected
- A connection of type PALO is expected
- Caught a number format exception converting minimum length…
AI-assisted analysis of pentaho/pentaho-kettle@f3058517a1 (2026-09-13).
Data as JSON: /api/errors/c1c37519daca1568.
Report an issue: GitHub.
Appendix: source
Thrown at core/src/main/java/org/pentaho/di/core/config/PropertySetter.java:103
if ( expression.length >= 2 ) {
OgnlExpression expr = ognlExpressions.get( value );
if ( expr == null ) {
synchronized ( ognlExpressions ) {
try {
expr = new OgnlExpression( expression[1] );
ognlExpressions.put( value, expr );
} catch ( OgnlException e ) {
throw new KettleConfigException( "Unable to parse expression [" + expression[1] + "] with Ognl", e );
}
}
}
// evaluate
try {
return expr.getValue( octx, this );
} catch ( OgnlException e ) {
throw new KettleConfigException(
"Unable to get value for expression [" + expression[1] + "] with Ognl", e );
}
} else {
throw new KettleConfigException(
"the ognl, directive need at least 2 parameters: ongl and the expression but "
+ expression.length + " parameters were found in [" + value + "]" );
}
}
}
View on GitHub (pinned to f3058517a1)