{"record":{"id":"db070f3ad1de5c7f","repo":"theonedev/onedev","slug":"undefined-label-labelname","errorCode":null,"errorMessage":"Undefined label: ${labelName}","messagePattern":"Undefined label: (.+?)","errorType":"exception","errorClass":"NotFoundException","httpStatus":404,"severity":"error","filePath":"server-core/src/main/java/io/onedev/server/util/QueryUtils.java","lineNumber":68,"sourceCode":"\t\t} catch (NumberFormatException e) {\n\t\t\tthrow new NotAcceptableException(\"Invalid number: \" + value);\n\t\t}\n\t}\n\n\tpublic static float getFloatValue(String value) {\n\t\ttry {\n\t\t\treturn Float.parseFloat(value);\n\t\t} catch (NumberFormatException e) {\n\t\t\tthrow new NotAcceptableException(\"Invalid decimal: \" + value);\n\t\t}\n\t}\n\t\n\tpublic static LabelSpec getLabelSpec(String labelName) {\n\t\tvar labelSpec = OneDev.getInstance(LabelSpecService.class).find(labelName);\n\t\tif (labelSpec != null) \n\t\t\treturn labelSpec;\n\t\telse\n\t\t\tthrow new NotFoundException(\"Undefined label: \" + labelName);\n\t}\n\t\n\tpublic static int getWorkingPeriodValue(String value) {\n\t\ttry {\n\t\t\tvar timeTrackingSetting = OneDev.getInstance(SettingService.class).getIssueSetting().getTimeTrackingSetting();\n\t\t\treturn timeTrackingSetting.parseWorkingPeriod(value);\n\t\t} catch (ValidationException e) {\n\t\t\tthrow new NotAcceptableException(\"Invalid working period: \" + value);\n\t\t}\n\t}\n\t\n\tpublic static long getLongValue(String value) {\n\t\ttry {\n\t\t\treturn Long.parseLong(value);\n\t\t} catch (NumberFormatException e) {\n\t\t\tthrow new NotAcceptableException(\"Invalid number: \" + value);\n\t\t}\n\t}","sourceCodeStart":50,"sourceCodeEnd":86,"githubUrl":"https://github.com/theonedev/onedev/blob/d44925c47c37992c828ea673a5f9620539bc3ff2/server-core/src/main/java/io/onedev/server/util/QueryUtils.java#L50-L86","documentation":"QueryUtils.getLabelSpec resolves a label name to a LabelSpec via LabelSpecService.find. If no label with that name exists, it throws NotFoundException(\"Undefined label: ...\"), converting unknown-label references in queries into 404-style lookup failures.","triggerScenarios":"Referencing a label by name in an issue query criterion (LabelSpec-based operators) when the label has been deleted, renamed, or never existed; label names with different case or scope prefix than defined.","commonSituations":"Saved queries broken after label cleanup/renames; cross-project label scope mismatches (label defined in another project); typos in query text; REST API consumers using stale label lists.","solutions":["List existing labels (Administration or project label settings) and correct the name in the query","Recreate the label if it was deleted and the query should still reference it","Include the correct scope prefix if the label is project-scoped"],"exampleFix":"// before\nQueryUtils.getLabelSpec(\"priorty::high\"); // throws\n// after\nQueryUtils.getLabelSpec(\"priority::high\");","handlingStrategy":"validation","validationCode":"LabelSpec spec = OneDev.getInstance(LabelSpecService.class).find(labelName);\nboolean labelExists = spec != null;","typeGuard":null,"tryCatchPattern":"try {\n    LabelSpec spec = QueryUtils.getLabelSpec(labelName);\n} catch (NotFoundException e) {\n    // offer the user a list of valid labels\n}","preventionTips":["Populate label pickers from the API instead of free-text entry","Review saved queries after deleting or renaming labels","Use fully scoped label names to avoid project-scope ambiguity"],"tags":["query","labels","not-found","onedev"],"backgroundTag":"resource-not-found","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"}