{"record":{"id":"1c32399948020634","repo":"theonedev/onedev","slug":"field-not-found-fieldname-1c3239","errorCode":null,"errorMessage":"\"Field not found: \" + fieldName","messagePattern":"\"Field not found: \" \\+ fieldName","errorType":"exception","errorClass":"ExplicitException","httpStatus":null,"severity":"error","filePath":"server-core/src/main/java/io/onedev/server/search/entity/pullrequest/PullRequestQuery.java","lineNumber":477,"sourceCode":"\t\t\t\t\tif (order.direction.getText().equals(\"desc\"))\n\t\t\t\t\t\trequestSort.setDirection(DESCENDING);\n\t\t\t\t\telse\n\t\t\t\t\t\trequestSort.setDirection(ASCENDING);\n\t\t\t\t} else {\n\t\t\t\t\trequestSort.setDirection(sortField.getDefaultDirection());\n\t\t\t\t}\n\t\t\t\trequestSorts.add(requestSort);\n\t\t\t}\n\n\t\t\treturn new PullRequestQuery(requestCriteria, requestSorts);\n\t\t} else {\n\t\t\treturn new PullRequestQuery();\n\t\t}\n\t}\n\n\tpublic static void checkField(String fieldName, int operator) {\n\t\tif (!PullRequest.QUERY_FIELDS.contains(fieldName))\n\t\t\tthrow new ExplicitException(\"Field not found: \" + fieldName);\n\t\tswitch (operator) {\n\t\t\tcase IsUntil:\n\t\t\tcase IsSince:\n\t\t\t\tif (!fieldName.equals(PullRequest.NAME_SUBMIT_DATE)\n\t\t\t\t\t\t&& !fieldName.equals(PullRequest.NAME_LAST_ACTIVITY_DATE)\n\t\t\t\t\t\t&& !fieldName.equals(PullRequest.NAME_CLOSE_DATE)) {\n\t\t\t\t\tthrow newOperatorException(fieldName, operator);\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tcase Contains:\n\t\t\t\tif (!fieldName.equals(PullRequest.NAME_TITLE)\n\t\t\t\t\t\t&& !fieldName.equals(PullRequest.NAME_DESCRIPTION)\n\t\t\t\t\t\t&& !fieldName.equals(PullRequest.NAME_COMMENT)) {\n\t\t\t\t\tthrow newOperatorException(fieldName, operator);\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tcase Is:\n\t\t\tcase IsNot:","sourceCodeStart":459,"sourceCodeEnd":495,"githubUrl":"https://github.com/theonedev/onedev/blob/d44925c47c37992c828ea673a5f9620539bc3ff2/server-core/src/main/java/io/onedev/server/search/entity/pullrequest/PullRequestQuery.java#L459-L495","documentation":"checkField validates that a field name used with an operator exists in PullRequest.QUERY_FIELDS and additionally that date-range operators (is since / is until) are only combined with date fields (submit date, last activity, close date). Unknown fields throw this ExplicitException before any criteria object is built.","triggerScenarios":"A query like '<unknown field> is ...' parsed for pull requests, where the field name is not in PullRequest.QUERY_FIELDS — misspellings, fields from other entities, or fields removed in newer OneDev versions.","commonSituations":"Typing 'milestone is ...' or 'priority is ...' (issue fields) into pull request search; typos like 'submitdate'; saved queries broken after an upgrade renamed fields.","solutions":["Use a field listed in the pull request query help (e.g. number, title, description, submitter, assignees, state, submit date, close date, last activity date).","Fix the spelling to the exact query field name.","If the field belongs to issues or builds, run the query against the matching entity query type instead.","After an upgrade, update saved queries whose fields were renamed/removed per release notes."],"exampleFix":"// before\nPullRequestQuery.parse(\"priority is high\"); // field not in QUERY_FIELDS\n// after\nPullRequestQuery.parse(\"state is open\");","handlingStrategy":"validation","validationCode":"Set<String> PR_FIELDS = Set.of(\"number\",\"title\",\"state\",\"description\",\"submitter\",\"assignees\",\"submit date\",\"close date\",\"last activity date\");\nif (!PR_FIELDS.contains(fieldName))\n    throw new IllegalArgumentException(\"Field not found: \" + fieldName);","typeGuard":"boolean isPrQueryField(String f) { return PR_FIELDS.contains(f); }","tryCatchPattern":"try {\n    PullRequestQuery.parse(query);\n} catch (ExplicitException e) {\n    if (e.getMessage().startsWith(\"Field not found\"))\n        suggestFields(e.getMessage()); // show valid field list to user\n    throw e;\n}","preventionTips":["Cross-check field names with the target entity's query help","Don't reuse issue/build field names in PR queries","Re-validate saved queries after OneDev upgrades"],"tags":["query-parser","onedev","pull-request"],"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-14T05:17:10.506Z"}