{"record":{"id":"fb4ec9c57c481523","repo":"theonedev/onedev","slug":"criteria-operator-is-not-supported-here","errorCode":null,"errorMessage":"Criteria '${operator}' is not supported here","messagePattern":"Criteria '(.+?)' is not supported here","errorType":"exception","errorClass":"ExplicitException","httpStatus":null,"severity":"error","filePath":"server-core/src/main/java/io/onedev/server/search/entity/issue/IssueQuery.java","lineNumber":204,"sourceCode":"\n\t\t\t\t\t@Override\n\t\t\t\t\tpublic Criteria<Issue> visitNumberCriteria(NumberCriteriaContext ctx) {\n\t\t\t\t\t\treturn new NumberCriteria(getNumber(ctx.getText()), Is);\n\t\t\t\t\t}\n\n\t\t\t\t\t@Override\n\t\t\t\t\tpublic Criteria<Issue> visitFuzzyCriteria(FuzzyCriteriaContext ctx) {\n\t\t\t\t\t\treturn new FuzzyCriteria(getValue(ctx.getText()));\n\t\t\t\t\t}\n\n\t\t\t\t\t@Override\n\t\t\t\t\tpublic Criteria<Issue> visitOperatorCriteria(OperatorCriteriaContext ctx) {\n\t\t\t\t\t\tswitch (ctx.operator.getType()) {\n\t\t\t\t\t\t\tcase Confidential:\n\t\t\t\t\t\t\t\treturn new ConfidentialCriteria();\n\t\t\t\t\t\t\tcase MentionedMe:\n\t\t\t\t\t\t\t\tif (!option.withCurrentUserCriteria())\n\t\t\t\t\t\t\t\t\tthrow new ExplicitException(\"Criteria '\" + ctx.operator.getText() + \"' is not supported here\");\n\t\t\t\t\t\t\t\treturn new MentionedMeCriteria();\n\t\t\t\t\t\t\tcase SubmittedByMe:\n\t\t\t\t\t\t\t\tif (!option.withCurrentUserCriteria())\n\t\t\t\t\t\t\t\t\tthrow new ExplicitException(\"Criteria '\" + ctx.operator.getText() + \"' is not supported here\");\n\t\t\t\t\t\t\t\treturn new SubmittedByMeCriteria();\n\t\t\t\t\t\t\tcase WatchedByMe:\n\t\t\t\t\t\t\t\tif (!option.withCurrentUserCriteria())\n\t\t\t\t\t\t\t\t\tthrow new ExplicitException(\"Criteria '\" + ctx.operator.getText() + \"' is not supported here\");\n\t\t\t\t\t\t\t\treturn new WatchedByMeCriteria();\n\t\t\t\t\t\t\tcase IgnoredByMe:\n\t\t\t\t\t\t\t\tif (!option.withCurrentUserCriteria())\n\t\t\t\t\t\t\t\t\tthrow new ExplicitException(\"Criteria '\" + ctx.operator.getText() + \"' is not supported here\");\n\t\t\t\t\t\t\t\treturn new IgnoredByMeCriteria();\n\t\t\t\t\t\t\tcase CommentedByMe:\n\t\t\t\t\t\t\t\tif (!option.withCurrentUserCriteria())\n\t\t\t\t\t\t\t\t\tthrow new ExplicitException(\"Criteria '\" + ctx.operator.getText() + \"' is not supported here\");\n\t\t\t\t\t\t\t\treturn new CommentedByMeCriteria();\n\t\t\t\t\t\t\tcase FixedInCurrentBuild:","sourceCodeStart":186,"sourceCodeEnd":222,"githubUrl":"https://github.com/theonedev/onedev/blob/d44925c47c37992c828ea673a5f9620539bc3ff2/server-core/src/main/java/io/onedev/server/search/entity/issue/IssueQuery.java#L186-L222","documentation":"In IssueQuery's ANTLR visitor, the 'MentionedMe' operator criteria is only allowed when the parse option enables current-user criteria (option.withCurrentUserCriteria(), typically set by the IssueQuery annotation). Otherwise an ExplicitException \"Criteria 'MentionedMe' is not supported here\" is thrown, because the query context has no notion of 'me'.","triggerScenarios":"Parsing an issue query containing 'MentionedMe' with parse options where withCurrentUserCriteria is false — e.g. text of an IssueQuery-annotated field that didn't set withCurrentUserCriteria=true, or programmatic IssueQuery.parse with default options.","commonSituations":"Declaring an @IssueQuery field without withCurrentUserCriteria=true while users type 'MentionedMe' into it; embedding user-entered queries into contexts that disallow user-relative criteria (e.g. subscription or automation queries).","solutions":["Set withCurrentUserCriteria = true on the @IssueQuery annotation so user-relative criteria are accepted","Remove 'MentionedMe' from the query or replace it with an explicit user criteria like 'Mentioned \"user\"'","If parsing programmatically, pass an option with withCurrentUserCriteria() == true"],"exampleFix":"// before\n@IssueQuery(name=\"My Query\", order=...)   // withCurrentUserCriteria defaults false\n// after\n@IssueQuery(name=\"My Query\", withCurrentUserCriteria=true, order=...)","handlingStrategy":"validation","validationCode":"if (queryText.matches(\".*\\\\bMentionedMe\\\\b.*\") && !option.withCurrentUserCriteria())\n    throw new ExplicitException(\"MentionedMe requires withCurrentUserCriteria=true\");","typeGuard":null,"tryCatchPattern":"try {\n    IssueQuery.parse(project, queryText, option);\n} catch (ExplicitException e) {\n    // inform user this field does not support *Me criteria\n}","preventionTips":["Always set withCurrentUserCriteria=true on @IssueQuery fields where users type queries","Reject *Me tokens in query fields that run without a user context"],"tags":["query","search-criteria","configuration"],"backgroundTag":"unsupported-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"}