theonedev/onedev · error · NotFoundException
Undefined label: ${labelName}
Error message
Undefined label: ${labelName} What it means
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.
Source
Thrown at server-core/src/main/java/io/onedev/server/util/QueryUtils.java:68
} catch (NumberFormatException e) {
throw new NotAcceptableException("Invalid number: " + value);
}
}
public static float getFloatValue(String value) {
try {
return Float.parseFloat(value);
} catch (NumberFormatException e) {
throw new NotAcceptableException("Invalid decimal: " + value);
}
}
public static LabelSpec getLabelSpec(String labelName) {
var labelSpec = OneDev.getInstance(LabelSpecService.class).find(labelName);
if (labelSpec != null)
return labelSpec;
else
throw new NotFoundException("Undefined label: " + labelName);
}
public static int getWorkingPeriodValue(String value) {
try {
var timeTrackingSetting = OneDev.getInstance(SettingService.class).getIssueSetting().getTimeTrackingSetting();
return timeTrackingSetting.parseWorkingPeriod(value);
} catch (ValidationException e) {
throw new NotAcceptableException("Invalid working period: " + value);
}
}
public static long getLongValue(String value) {
try {
return Long.parseLong(value);
} catch (NumberFormatException e) {
throw new NotAcceptableException("Invalid number: " + value);
}
}View on GitHub (pinned to d44925c47c)
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
Example fix
// before
QueryUtils.getLabelSpec("priorty::high"); // throws
// after
QueryUtils.getLabelSpec("priority::high"); Defensive patterns
Strategy: validation
Validate before calling
LabelSpec spec = OneDev.getInstance(LabelSpecService.class).find(labelName); boolean labelExists = spec != null;
Try / catch
try {
LabelSpec spec = QueryUtils.getLabelSpec(labelName);
} catch (NotFoundException e) {
// offer the user a list of valid labels
} Prevention
- 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
When it happens
Trigger: 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.
Common situations: 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.
Understand the failure class
Background: 'Could not be found', 'does not exist', 'not found in database': the resource-not-found family when an ID, slug, key, or URI lookup comes back empty — this error's family across 20 libraries.
Related errors
- Not found
- Unable to find user with login: ${loginName}
- Unable to find group: ${groupName}
- Iteration '${iterationName}' not found
- Link spec not found: ${linkName}
AI-assisted analysis of theonedev/onedev@d44925c47c (2026-09-06).
Data as JSON: /api/errors/db070f3ad1de5c7f.
Report an issue: GitHub.