{"record":{"id":"1699c612f96449ab","repo":"theonedev/onedev","slug":"unexpected-operator-1699c6","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/search/entity/agent/AgentQuery.java","lineNumber":116,"sourceCode":"\t\t\t\t\t\treturn new FuzzyCriteria(getValue(ctx.getText()));\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t\t@Override\n\t\t\t\t\tpublic Criteria<Agent> visitOperatorCriteria(OperatorCriteriaContext ctx) {\n\t\t\t\t\t\tif (forRunner)\n\t\t\t\t\t\t\tthrow new ExplicitException(\"Criteria '\" + ctx.operator.getText() + \"' is not supported here\");\n\t\t\t\t\t\t\n\t\t\t\t\t\tswitch (ctx.operator.getType()) {\n\t\t\t\t\t\tcase Online:\n\t\t\t\t\t\t\treturn new OnlineCriteria();\n\t\t\t\t\t\tcase Offline:\n\t\t\t\t\t\t\treturn new OfflineCriteria();\n\t\t\t\t\t\tcase Paused:\n\t\t\t\t\t\t\treturn new PausedCriteria();\n\t\t\t\t\t\tcase HasRunningBuilds:\n\t\t\t\t\t\t\treturn new HasRunningBuildsCriteria();\n\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\tthrow new ExplicitException(\"Unexpected operator: \" + ctx.operator.getText());\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t\t@Override\n\t\t\t\t\tpublic Criteria<Agent> visitOperatorValueCriteria(OperatorValueCriteriaContext ctx) {\n\t\t\t\t\t\tif (forRunner && ctx.HasAttribute() == null)\n\t\t\t\t\t\t\tthrow new ExplicitException(\"Criteria '\" + ctx.operator.getText() + \"' is not supported here\");\n\t\t\t\t\t\t\n\t\t\t\t\t\tvar criterias = new ArrayList<Criteria<Agent>>();\n\t\t\t\t\t\tfor (var quoted: ctx.criteriaValue.Quoted()) {\n\t\t\t\t\t\t\tString value = getValue(quoted.getText());\n\t\t\t\t\t\t\tif (ctx.HasAttribute() != null)\n\t\t\t\t\t\t\t\tcriterias.add(new HasAttributeCriteria(value));\n\t\t\t\t\t\t\telse if (ctx.NotUsedSince() != null)\n\t\t\t\t\t\t\t\tcriterias.add(new NotUsedSinceCriteria(value));\n\t\t\t\t\t\t\telse if (ctx.EverUsedSince() != null)\n\t\t\t\t\t\t\t\tcriterias.add(new EverUsedSinceCriteria(value));\n\t\t\t\t\t\t\telse if (ctx.RanBuild() != null)","sourceCodeStart":98,"sourceCodeEnd":134,"githubUrl":"https://github.com/theonedev/onedev/blob/d44925c47c37992c828ea673a5f9620539bc3ff2/server-core/src/main/java/io/onedev/server/search/entity/agent/AgentQuery.java#L98-L134","documentation":"Fallback branch of visitOperatorCriteria: if the ANTLR operator token type is none of the recognized cases (Online/Offline/Paused/HasRunningBuilds), the parser throws ExplicitException \"Unexpected operator: <text>\".","triggerScenarios":"A new or unexpected operator token reaches visitOperatorCriteria without a corresponding switch case — typically after grammar changes or an unrecognized keyword in the query.","commonSituations":"Running a newer client query against an older parser; typo in an operator keyword that the lexer still tokenizes as operator; plugin/extension adding new operators.","solutions":["Use a supported operator: online, offline, paused, or has running builds","Fix the typo/keyword spelling in the query","Upgrade OneDev so the parser recognizes the newer operator"],"exampleFix":"// before\nq = \"runnin\" // typo\n// after\nq = \"has running builds\"","handlingStrategy":"validation","validationCode":"Set.of(\"online\",\"offline\",\"paused\",\"has running builds\").contains(op); // must be true before parsing","typeGuard":null,"tryCatchPattern":"try { new AgentQuery(q, forRunner); } catch (ExplicitException e) { /* unknown operator — fix spelling */ }","preventionTips":["Use only documented operator keywords","Keep client and server OneDev versions aligned","Copy queries from the UI rather than retyping operators"],"tags":["query-syntax","agent","onedev"],"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-14T00:17:10.932Z"}