{"record":{"id":"bd7212c6e4274402","repo":"theonedev/onedev","slug":"field-not-found-fieldname-bd7212","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/pack/PackQuery.java","lineNumber":233,"sourceCode":"\t\t\t\t\tif (order.direction.getText().equals(\"desc\"))\n\t\t\t\t\t\tpackSort.setDirection(DESCENDING);\n\t\t\t\t\telse\n\t\t\t\t\t\tpackSort.setDirection(ASCENDING);\n\t\t\t\t} else {\n\t\t\t\t\tpackSort.setDirection(sortField.getDefaultDirection());\n\t\t\t\t}\n\t\t\t\tbuildSorts.add(packSort);\n\t\t\t}\n\t\t\t\n\t\t\treturn new PackQuery(packCriteria, buildSorts);\n\t\t} else {\n\t\t\treturn new PackQuery();\n\t\t}\n\t}\n\t\n\tpublic static void checkField(Project project, String fieldName, int operator) {\n\t\tif (!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(NAME_PUBLISH_DATE))\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(NAME_PROJECT) && !fieldName.equals(NAME_TYPE)\n\t\t\t\t\t\t&& !fieldName.equals(NAME_NAME) && !fieldName.equals(NAME_VERSION)\n\t\t\t\t\t\t&& !fieldName.equals(NAME_LABEL)) {\n\t\t\t\t\tthrow newOperatorException(fieldName, operator);\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t}\n\t}\n\t\n\tprivate static ExplicitException newOperatorException(String fieldName, int operator) {","sourceCodeStart":215,"sourceCodeEnd":251,"githubUrl":"https://github.com/theonedev/onedev/blob/d44925c47c37992c828ea673a5f9620539bc3ff2/server-core/src/main/java/io/onedev/server/search/entity/pack/PackQuery.java#L215-L251","documentation":"PackQuery.checkField validates that a field name used with an operator in a pack query is one of QUERY_FIELDS, and then that the operator is valid for that field. An unknown field name throws ExplicitException(\"Field not found: <fieldName>\").","triggerScenarios":"Calling PackQuery.parse with a field-operator-value criterion (e.g. '<field> is since <value>') where <field> is not in PackQuery.QUERY_FIELDS — misspellings or fields from other entity types (issue/build query fields) used in pack queries.","commonSituations":"Reusing issue query field names in pack queries; typos in field names; version changes renaming fields; API clients constructing query strings programmatically with wrong field keys.","solutions":["Use a field defined in PackQuery.QUERY_FIELDS (e.g. 'publish date')","Verify exact field spelling against the pack query documentation/UI autocomplete","Catch ExplicitException and surface valid field names to the caller"],"exampleFix":"// before\n\"created is since \"2024-01-01\"\" // 'created' not a pack field\n// after\n\"\"publish date\" is since \"2024-01-01\"\"","handlingStrategy":"validation","validationCode":"function validatePackField(f) { const fields = ['publish date']; /* PackQuery.QUERY_FIELDS */ if (!fields.includes(f)) throw new Error('Field not found: ' + f); }","typeGuard":"null","tryCatchPattern":"try { PackQuery.parse(project, q); } catch (ExplicitException e) { if (e.getMessage().startsWith('Field not found')) showError('Unknown pack query field: ' + e.getMessage()); else throw e; }","preventionTips":["Use only fields in PackQuery.QUERY_FIELDS","Do not reuse field names from other entity queries","Pair each field with operators valid for it (e.g. publish date with is since/is until)","Check field spelling against docs/UI"],"tags":["query","validation","onedev"],"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"}