{"record":{"id":"615038f3e9a4e3f6","repo":"theonedev/onedev","slug":"field-not-found-fieldname-615038","errorCode":null,"errorMessage":"Field not found: ${fieldName}","messagePattern":"Field not found: (.+?)","errorType":"exception","errorClass":"ExplicitException","httpStatus":null,"severity":"error","filePath":"server-core/src/main/java/io/onedev/server/search/entity/project/ProjectQuery.java","lineNumber":268,"sourceCode":"\t\t\t\t} else {\n\t\t\t\t\tprojectSort.setDirection(sortField.getDefaultDirection());\n\t\t\t\t}\n\t\t\t\tprojectSorts.add(projectSort);\n\t\t\t}\n\t\t\t\n\t\t\treturn new ProjectQuery(projectCriteria, projectSorts);\n\t\t} else {\n\t\t\treturn new ProjectQuery();\n\t\t}\n\t}\n\t\n\tprivate static ExplicitException newOperatorException(String fieldName, int operator) {\n\t\treturn new ExplicitException(\"Field '\" + fieldName + \"' is not applicable for operator '\" + getRuleName(operator) + \"'\");\n\t}\n\t\n\tpublic static void checkField(String fieldName, int operator) {\n\t\tif (!Project.QUERY_FIELDS.contains(fieldName))\n\t\t\tthrow new ExplicitException(\"Field not found: \" + fieldName);\n\t\tswitch (operator) {\n\t\t\tcase Contains:\n\t\t\t\tif (!fieldName.equals(Project.NAME_DESCRIPTION))\n\t\t\t\t\tthrow newOperatorException(fieldName, operator);\n\t\t\t\tbreak;\n\t\t\tcase Is:\n\t\t\tcase IsNot:\n\t\t\t\tif (!fieldName.equals(Project.NAME_NAME)\n\t\t\t\t\t\t&& !fieldName.equals(Project.NAME_ID)\n\t\t\t\t\t\t&& !fieldName.equals(Project.NAME_KEY)\n\t\t\t\t\t\t&& !fieldName.equals(Project.NAME_LABEL)\n\t\t\t\t\t\t&& !fieldName.equals(Project.NAME_SERVICE_DESK_EMAIL_ADDRESS)\n\t\t\t\t\t\t&& !fieldName.equals(Project.NAME_PATH)) {\n\t\t\t\t\tthrow newOperatorException(fieldName, operator);\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tcase IsGreaterThan:\n\t\t\tcase IsLessThan:","sourceCodeStart":250,"sourceCodeEnd":286,"githubUrl":"https://github.com/theonedev/onedev/blob/d44925c47c37992c828ea673a5f9620539bc3ff2/server-core/src/main/java/io/onedev/server/search/entity/project/ProjectQuery.java#L250-L286","documentation":"checkField (called during parsing of field-operator-value criteria) validates the field name against Project.QUERY_FIELDS and then against per-operator constraints; an unknown field name throws ExplicitException('Field not found: X') (operator mismatches get a separate message).","triggerScenarios":"A project query criterion like \"nonexistent == \\\"x\\\"\" where the field name is not in Project.QUERY_FIELDS; also hit indirectly whenever visitFieldOperatorValueCriteria processes each parsed criterion.","commonSituations":"Typos in field names; using fields from issue/pull-request queries in project queries; renamed fields across OneDev upgrades.","solutions":["Use a field in Project.QUERY_FIELDS (e.g. \"name\", \"name description\", \"last activity\").","Fix spelling/quotes; field names in queries must match the lexer keywords exactly.","Catch ExplicitException and list valid fields in the error surfaced to the user.","Call ProjectQuery.checkField(fieldName, operator) in your own code to validate before building queries."],"exampleFix":"// before\n\"titel == \\\"foo\\\"\"  // typo\n// after\n\"name == \\\"foo\\\"\"","handlingStrategy":"validation","validationCode":"try { ProjectQuery.checkField(fieldName, operator); } catch (ExplicitException e) { /* invalid field */ }","typeGuard":"null","tryCatchPattern":"try { q = ProjectQuery.parse(text); } catch (ExplicitException e) { showFieldHints(Project.QUERY_FIELDS); }","preventionTips":["Use exact field names from Project.QUERY_FIELDS","Validate fields at query save time","Do not reuse field names from other entity queries","Catch ExplicitException and suggest valid fields"],"tags":["query","validation","parsing"],"backgroundTag":"invalid-query-parameter","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"}