{"record":{"id":"cfa661cd98f669d9","repo":"theonedev/onedev","slug":"unexpected-operator","errorCode":null,"errorMessage":"Unexpected operator: ","messagePattern":"Unexpected operator: ","errorType":"exception","errorClass":"ExplicitException","httpStatus":null,"severity":"error","filePath":"server-core/src/main/java/io/onedev/server/buildspec/job/action/condition/ActionCondition.java","lineNumber":124,"sourceCode":"\t\t\t\t\tswitch (ctx.operator.getType()) {\n\t\t\t\t\tcase ActionConditionLexer.Successful:\n\t\t\t\t\t\treturn new SuccessfulCriteria();\n\t\t\t\t\tcase ActionConditionLexer.Failed:\n\t\t\t\t\t\treturn new FailedCriteria();\n\t\t\t\t\tcase ActionConditionLexer.Cancelled:\n\t\t\t\t\t\treturn new CancelledCriteria();\n\t\t\t\t\tcase ActionConditionLexer.TimedOut:\n\t\t\t\t\t\treturn new TimedOutCriteria();\n\t\t\t\t\tcase ActionConditionLexer.PreviousIsSuccessful:\n\t\t\t\t\t\treturn new PreviousIsSuccessfulCriteria();\n\t\t\t\t\tcase ActionConditionLexer.PreviousIsFailed:\n\t\t\t\t\t\treturn new PreviousIsFailedCriteria();\n\t\t\t\t\tcase ActionConditionLexer.PreviousIsCancelled:\n\t\t\t\t\t\treturn new PreviousIsCancelledCriteria();\n\t\t\t\t\tcase ActionConditionLexer.PreviousIsTimedOut:\n\t\t\t\t\t\treturn new PreviousIsTimedOutCriteria();\n\t\t\t\t\tdefault:\n\t\t\t\t\t\tthrow new ExplicitException(\"Unexpected operator: \" + ctx.operator.getText());\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\t@Override\n\t\t\t\tpublic Criteria<Build> visitFieldOperatorCriteria(FieldOperatorCriteriaContext ctx) {\n\t\t\t\t\tString fieldName = getValue(ctx.Quoted().getText());\n\t\t\t\t\tint operator = ctx.operator.getType();\n\t\t\t\t\tcheckField(job, fieldName, operator);\n\t\t\t\t\tif (fieldName.equals(NAME_BRANCH))\n\t\t\t\t\t\treturn new BranchEmptyCriteria(operator);\n\t\t\t\t\telse if (fieldName.equals(NAME_TAG))\n\t\t\t\t\t\treturn new TagEmptyCriteria(operator);\n\t\t\t\t\telse if (fieldName.equals(NAME_PULL_REQUEST))\n\t\t\t\t\t\treturn new PullRequestEmptyCriteria(operator);\n\t\t\t\t\telse if (fieldName.equals(NAME_AI_PULL_REQUEST))\n\t\t\t\t\t\treturn new AiPullRequestEmptyCriteria(operator);\n\t\t\t\t\telse\n\t\t\t\t\t\treturn new ParamEmptyCriteria(fieldName, operator);","sourceCodeStart":106,"sourceCodeEnd":142,"githubUrl":"https://github.com/theonedev/onedev/blob/d44925c47c37992c828ea673a5f9620539bc3ff2/server-core/src/main/java/io/onedev/server/buildspec/job/action/condition/ActionCondition.java#L106-L142","documentation":"Thrown by ActionCondition's visitor when an operator token in the parsed condition is not recognized as a supported operator for the given criteria context. The switch over lexer token types falls through to default and raises an ExplicitException with the offending operator text.","triggerScenarios":"A condition expression uses an operator token that exists grammatically but has no handler in visitOperatorCriteria/visitFieldOperatorCriteria — e.g. an operator applied to a state criterion or an unsupported field operator.","commonSituations":"Applying comparison operators (>, <) to boolean/state criteria; using an operator added in a newer OneDev version against an older grammar, or vice versa; typos that still tokenize to an operator rule.","solutions":["Check the operator text in the error message and replace it with a supported operator for that criterion (e.g. 'is failed', 'is successful' for previous-build criteria).","Consult the action condition operator reference in OneDev docs for valid field/operator combinations.","Update OneDev if the operator is documented for a newer version."],"exampleFix":"// before\ncondition: previous build > failed\n\n// after\ncondition: previous build is failed","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n    ActionCondition.parse(text, job, build);\n} catch (ExplicitException e) {\n    if (e.getMessage().startsWith(\"Unexpected operator:\")) {\n        // show supported operator list for the criterion\n    } else throw e;\n}","preventionTips":["Use only operators documented for each criterion kind.","Never apply numeric operators to state/boolean criteria.","Pin OneDev version in docs that teach condition syntax."],"tags":["onedev","condition-syntax","operator","buildspec"],"backgroundTag":"invalid-enum-value","analyzedSha":"d44925c47c37992c828ea673a5f9620539bc3ff2","analyzedAt":"2026-09-06T07:18:27.995Z","contentChangedAt":"2026-09-06T07:18:27.995Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}