2.11. Error messages for DRL troubleshooting
Red Hat Decision Manager provides standardized messages for DRL errors to help you troubleshoot and resolve problems in your DRL files. The error messages use the following format:
図2.1 Error message format for DRL file problems
- 1st Block: Error code
- 2nd Block: Line and column in the DRL source where the error occurred
- 3rd Block: Description of the problem
- 4th Block: Component in the DRL source (rule, function, query) where the error occurred
- 5th Block: Pattern in the DRL source where the error occurred (if applicable)
Red Hat Decision Manager supports the following standardized error messages:
- 101: no viable alternative
Indicates that the parser reached a decision point but could not identify an alternative.
Example rule with incorrect spelling
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Error message
[ERR 101] Line 4:4 no viable alternative at input 'exits' in rule "simple rule"
[ERR 101] Line 4:4 no viable alternative at input 'exits' in rule "simple rule"
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Example rule without a rule name
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Error message
[ERR 101] Line 3:2 no viable alternative at input 'when'
[ERR 101] Line 3:2 no viable alternative at input 'when'
Copy to Clipboard Copied! Toggle word wrap Toggle overflow In this example, the parser encountered the keyword
when
but expected the rule name, so it flagswhen
as the incorrect expected token.Example rule with incorrect syntax
1: rule "simple rule" 2: when 3: Student( name == "Andy ) // Must be `"Andy"` 4: then 5: end
1: rule "simple rule" 2: when 3: Student( name == "Andy ) // Must be `"Andy"` 4: then 5: end
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Error message
[ERR 101] Line 0:-1 no viable alternative at input '<eof>' in rule "simple rule" in pattern Student
[ERR 101] Line 0:-1 no viable alternative at input '<eof>' in rule "simple rule" in pattern Student
Copy to Clipboard Copied! Toggle word wrap Toggle overflow 注記A line and column value of
0:-1
means the parser reached the end of the source file (<eof>
) but encountered incomplete constructs, usually due to missing quotation marks"…"
, apostrophes'…'
, or parentheses(…)
.- 102: mismatched input
Indicates that the parser expected a particular symbol that is missing at the current input position.
Example rule with an incomplete rule statement
1: rule simple_rule 2: when 3: $p : Person( // Must be a complete rule statement
1: rule simple_rule 2: when 3: $p : Person( // Must be a complete rule statement
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Error message
[ERR 102] Line 0:-1 mismatched input '<eof>' expecting ')' in rule "simple rule" in pattern Person
[ERR 102] Line 0:-1 mismatched input '<eof>' expecting ')' in rule "simple rule" in pattern Person
Copy to Clipboard Copied! Toggle word wrap Toggle overflow 注記A line and column value of
0:-1
means the parser reached the end of the source file (<eof>
) but encountered incomplete constructs, usually due to missing quotation marks"…"
, apostrophes'…'
, or parentheses(…)
.Example rule with incorrect syntax
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Error messages
[ERR 102] Line 5:36 mismatched input ',' expecting ')' in rule "Wrong syntax" in pattern Car [ERR 101] Line 5:57 no viable alternative at input 'type' in rule "Wrong syntax" [ERR 102] Line 5:106 mismatched input ')' expecting 'then' in rule "Wrong syntax"
[ERR 102] Line 5:36 mismatched input ',' expecting ')' in rule "Wrong syntax" in pattern Car [ERR 101] Line 5:57 no viable alternative at input 'type' in rule "Wrong syntax" [ERR 102] Line 5:106 mismatched input ')' expecting 'then' in rule "Wrong syntax"
Copy to Clipboard Copied! Toggle word wrap Toggle overflow In this example, the syntactic problem results in multiple error messages related to each other. The single solution of replacing the commas
,
with&&
operators resolves all errors. If you encounter multiple errors, resolve one at a time in case errors are consequences of previous errors.- 103: failed predicate
Indicates that a validating semantic predicate evaluated to
false
. These semantic predicates are typically used to identify component keywords in DRL files, such asdeclare
,rule
,exists
,not
, and others.Example rule with an invalid keyword
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Error message
[ERR 103] Line 6:0 rule 'rule_key' failed predicate: {(validateIdentifierKey(DroolsSoftKeywords.RULE))}? in rule
[ERR 103] Line 6:0 rule 'rule_key' failed predicate: {(validateIdentifierKey(DroolsSoftKeywords.RULE))}? in rule
Copy to Clipboard Copied! Toggle word wrap Toggle overflow The
Some text
line is invalid because it does not begin with or is not a part of a DRL keyword construct, so the parser fails to validate the rest of the DRL file.注記This error is similar to
102: mismatched input
, but usually involves DRL keywords.- 104: trailing semi-colon not allowed
Indicates that an
eval()
clause in a rule condition uses a semicolon;
but must not use one.Example rule with
eval()
and trailing semicolon1: rule "simple rule" 2: when 3: eval( abc(); ) // Must not use semicolon `;` 4: then 5: end
1: rule "simple rule" 2: when 3: eval( abc(); ) // Must not use semicolon `;` 4: then 5: end
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Error message
[ERR 104] Line 3:4 trailing semi-colon not allowed in rule "simple rule"
[ERR 104] Line 3:4 trailing semi-colon not allowed in rule "simple rule"
Copy to Clipboard Copied! Toggle word wrap Toggle overflow - 105: did not match anything
Indicates that the parser reached a sub-rule in the grammar that must match an alternative at least once, but the sub-rule did not match anything. The parser has entered a branch with no way out.
Example rule with invalid text in an empty condition
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Error message
[ERR 105] Line 2:2 required (...)+ loop did not match anything at input 'WHEN' in rule "empty condition"
[ERR 105] Line 2:2 required (...)+ loop did not match anything at input 'WHEN' in rule "empty condition"
Copy to Clipboard Copied! Toggle word wrap Toggle overflow In this example, the condition is intended to be empty but the word
None
is used. This error is resolved by removingNone
, which is not a valid DRL keyword, data type, or pattern construct.
If you encounter other DRL error messages that you cannot resolve, contact your Red Hat Technical Account Manager.