theonedev/onedev · warning · NotAcceptableException
Invalid number: ${value}
Error message
Invalid number: ${value} What it means
QueryUtils.getIntValue converts a query field value string to an int via Integer.parseInt. When the value is not a valid integer, it throws NotAcceptableException with this message, surfacing a user-entered query operand error as a 4xx-style validation failure.
Source
Thrown at server-core/src/main/java/io/onedev/server/util/QueryUtils.java:51
import io.onedev.server.service.LabelSpecService;
import io.onedev.server.service.ProjectService;
import io.onedev.server.service.PullRequestService;
import io.onedev.server.service.SettingService;
import io.onedev.server.service.UserService;
public class QueryUtils {
private static final Pattern INSIDE_QUOTE = Pattern.compile("\"([^\"\\\\]|\\\\.)*");
public static String getValue(String token) {
return StringUtils.unescape(FenceAware.unfence(token));
}
public static int getIntValue(String value) {
try {
return Integer.parseInt(value);
} 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);
}View on GitHub (pinned to d44925c47c)
Solutions
- Correct the query operand to a whole number within int range (e.g. 5 instead of 5.5)
- Strip whitespace/quotes around the value
- Use getFloatValue-style comparison or a different field type if a decimal is intended
Example fix
// before
getIntValue("3.5"); // throws
// after
int v = QueryUtils.getIntValue(String.valueOf(Math.round(Float.parseFloat("3.5")))); // 4 Defensive patterns
Strategy: validation
Validate before calling
function isInt(v) { return /^-?\d+$/.test(v.trim()) && Number.isInteger(Number(v)); } Type guard
boolean isValidInt(String v) {
try { Integer.parseInt(v.trim()); return true; } catch (NumberFormatException e) { return false; }
} Try / catch
try {
int v = QueryUtils.getIntValue(raw);
} catch (NotAcceptableException e) {
// reject or re-prompt for the query operand
} Prevention
- Validate numeric operands client-side before building queries
- Never paste locale-formatted numbers (spaces, commas) into query fields
- Check int range before submitting large values
When it happens
Trigger: Using a non-integer operand (e.g. 'abc', '1.5', '', '99999999999') for an integer-typed issue field in an issue query or REST query parameter parsed through QueryUtils.
Common situations: Typing a decimal or text into a numeric query criterion; pasting values with whitespace or thousands separators; overflow beyond Integer.MAX_VALUE; saved query broken after field type changed.
Related errors
- Criteria '${operator}' is not supported here
- Unexpected operator: ${operator}
- Unexpected criteria: ${operator}
- Cannot order by field: ${fieldName}
- Field not found: ${fieldName}
AI-assisted analysis of theonedev/onedev@d44925c47c (2026-09-06).
Data as JSON: /api/errors/2e654e974bdee8bb.
Report an issue: GitHub.