pentaho/pentaho-kettle · error · KettleConfigException

the ognl, directive need at least 2 parameters: ongl and…

Error message

the ognl, directive need at least 2 parameters: ongl and the expression but <count> parameters were found in [<value>]

What it means

The 'ognl' directive requires at least 2 colon-separated tokens: the directive name and the OGNL expression. setOgnlProperty throws this KettleConfigException when fewer than 2 tokens were supplied, reporting the actual token count and the raw value.

Solutions

  1. Supply the expression after the directive: 'ognl:<valid OGNL expression>'.
  2. Fix variable/parameter substitution so the expression part is not empty.
  3. Validate the value with a pre-check (value.startsWith("ognl:") && value.length() > "ognl:".length()) before calling setProperty.

Example fix

// before
propertySetter.setProperty(obj, "name", "ognl:");

// after
propertySetter.setProperty(obj, "name", "ognl:getName()");
Defensive patterns

Strategy: validation

Validate before calling

if (value == null || !value.startsWith("ognl:") || value.substring("ognl:".length()).isBlank()) {
  throw new IllegalArgumentException("ognl directive requires an expression: ognl:<expression>");
}

Prevention

When it happens

Trigger: setProperty(obj, property, "ognl") or "ognl:" with no expression — the split on ':' yields fewer than 2 elements so there is no expression to compile.

Common situations: Config values where the OGNL expression was accidentally deleted, leaving only the directive prefix; variable substitution that resolved the expression part to empty; truncated config lines.

Understand the failure class

Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.

Related errors


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

Appendix: source

Thrown at core/src/main/java/org/pentaho/di/core/config/PropertySetter.java:107

          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)