pentaho/pentaho-kettle · error · KettleConfigException
Unable to parse expression
Error message
Unable to parse expression [<expression>] with Ognl
What it means
setOgnlProperty compiles the OGNL expression (second token of an 'ognl:expression' value) into an OgnlExpression, caching compiled expressions. This error is thrown when OGNL fails to parse the expression syntax (OgnlException), wrapped in a KettleConfigException with the offending expression text.
Solutions
- Fix the OGNL expression syntax in the config value; test it in an OGNL evaluator first.
- Remove colons from the expression or restructure it, since the value is split on ':' — only token[1] onward matters but splitting corrupts complex expressions.
- Validate expression[1] with ognl.Ognl.parseExpression() in a unit test before shipping the config.
- Catch KettleConfigException during config load and log expression[1] to pinpoint the bad config entry.
Example fix
// before propertySetter.setProperty(obj, "name", "ognl:getNaem()"); // after propertySetter.setProperty(obj, "name", "ognl:getName()");
Defensive patterns
Strategy: try-catch
Validate before calling
try {
org.apache.commons.ognl.Ognl.parseExpression(exprString);
} catch (Exception e) {
throw new IllegalArgumentException("Invalid OGNL expression in config: " + exprString, e);
} Try / catch
try {
propertySetter.setProperty(obj, property, value);
} catch (KettleConfigException e) {
LOG.error("OGNL parse failed for property " + property + ", value=" + value, e);
} Prevention
- Test OGNL expressions in a scratch evaluator before committing them to config.
- Avoid colons inside OGNL expressions since values are split on ':'.
- Add CI validation that compiles all ognl: config values.
When it happens
Trigger: Calling setProperty with a value like 'ognl:<bad syntax>' where expression[1] is not valid OGNL — e.g. unbalanced parentheses, invalid identifiers, malformed method calls.
Common situations: Hand-written OGNL in config files with typos; expressions referencing removed/renamed properties that fail at parse time; colons inside the expression truncating it since the value is split on ':' before parsing.
Understand the failure class
- Parsing and encoding errors: unexpected token, malformed input — why parsers reject input and how to find the real culprit.
Related errors
- the ognl, directive need at least 2 parameters: ongl and…
- Unable to get value for 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/d38797e87cd48e21.
Report an issue: GitHub.
Appendix: source
Thrown at core/src/main/java/org/pentaho/di/core/config/PropertySetter.java:94
return BaseMessages.getString( packageName, key );
} else {
throw new KettleConfigException(
"the i18, directive need 3 parameters: i18n, the package name and the key, but "
+ expression.length + " parameters were found in [" + value + "]" );
}
}
private Object setOgnlProperty( String[] expression, String value ) throws KettleConfigException {
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)