{"record":{"id":"9f4049b1ca9debf2","repo":"pentaho/pentaho-kettle","slug":"the-ognl-directive-need-at-least-2-parameters-ongl-and-the","errorCode":null,"errorMessage":"the ognl, directive need at least 2 parameters: ongl and the expression but <count> parameters were found in [<value>]","messagePattern":"the ognl, directive need at least 2 parameters: ongl and the expression but <count> parameters were found in \\[<value>\\]","errorType":"exception","errorClass":"KettleConfigException","httpStatus":null,"severity":"error","filePath":"core/src/main/java/org/pentaho/di/core/config/PropertySetter.java","lineNumber":107,"sourceCode":"          try {\n            expr = new OgnlExpression( expression[1] );\n            ognlExpressions.put( value, expr );\n\n          } catch ( OgnlException e ) {\n            throw new KettleConfigException( \"Unable to parse expression [\" + expression[1] + \"] with Ognl\", e );\n          }\n        }\n      }\n\n      // evaluate\n      try {\n        return expr.getValue( octx, this );\n      } catch ( OgnlException e ) {\n        throw new KettleConfigException(\n          \"Unable to get value for expression [\" + expression[1] + \"] with Ognl\", e );\n      }\n    } else {\n      throw new KettleConfigException(\n        \"the ognl, directive need at least 2 parameters: ongl and the expression but \"\n          + expression.length + \" parameters were found in [\" + value + \"]\" );\n    }\n  }\n}\n","sourceCodeStart":89,"sourceCodeEnd":113,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/core/src/main/java/org/pentaho/di/core/config/PropertySetter.java#L89-L113","documentation":"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.","triggerScenarios":"setProperty(obj, property, \"ognl\") or \"ognl:\" with no expression — the split on ':' yields fewer than 2 elements so there is no expression to compile.","commonSituations":"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.","solutions":["Supply the expression after the directive: 'ognl:<valid OGNL expression>'.","Fix variable/parameter substitution so the expression part is not empty.","Validate the value with a pre-check (value.startsWith(\"ognl:\") && value.length() > \"ognl:\".length()) before calling setProperty."],"exampleFix":"// before\npropertySetter.setProperty(obj, \"name\", \"ognl:\");\n\n// after\npropertySetter.setProperty(obj, \"name\", \"ognl:getName()\");","handlingStrategy":"validation","validationCode":"if (value == null || !value.startsWith(\"ognl:\") || value.substring(\"ognl:\".length()).isBlank()) {\n  throw new IllegalArgumentException(\"ognl directive requires an expression: ognl:<expression>\");\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always write the full 'ognl:<expression>' pair, never the bare directive.","Check that config templating does not drop the expression segment.","Validate directive values (token count) at config load time."],"tags":["config","ognl","missing-argument"],"backgroundTag":"missing-required-argument","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"}