theonedev/onedev · error · ConversionException
Invalid number: ${token}
Error message
Invalid number: ${token} What it means
NumberListEditor converts user-entered text into a list of numbers by splitting input into tokens and parsing each with Long.valueOf or Integer.valueOf depending on the element class. If a token is not a valid number, NumberFormatException is caught and rethrown as a Wicket ConversionException with the offending token. This gives per-token feedback for numeric list inputs.
Source
Thrown at server-core/src/main/java/io/onedev/server/web/editable/numberlist/NumberListEditor.java:72
});
input.add(newPlaceholderModifier());
}
@Override
protected List<Number> convertInputToValue() throws ConversionException {
List<Number> numbers = new ArrayList<>();
String text = input.getConvertedInput();
if (StringUtils.isNotBlank(text)) {
for (String token : StringUtils.splitAndTrim(text, " ")) {
try {
if (elementClass == Long.class)
numbers.add(Long.valueOf(token));
else
numbers.add(Integer.valueOf(token));
} catch (NumberFormatException e) {
throw new ConversionException("Invalid number: " + token);
}
}
}
return numbers;
}
@Override
public boolean needExplicitSubmit() {
return true;
}
}
View on GitHub (pinned to d44925c47c)
Solutions
- Correct the input so each comma/space separated token is a whole number (e.g. 1, 2, 3).
- Remove decimal points, thousands separators, currency symbols, and empty entries (double commas/trailing commas).
- If the values genuinely need decimals, the field's element type is wrong — use a property type supporting floats rather than List<Long>/List<Integer>.
- Check for invisible characters when pasting (non-breaking spaces) and retype the value.
Example fix
// before (input) 1, 2.5, 3 // after (input) 1, 2, 3
Defensive patterns
Strategy: validation
Validate before calling
// client-side pre-check before submitting a number list field
function isValidNumberList(text) {
return text.split(/[,\s]+/).filter(t => t.length > 0)
.every(t => /^-?\d+$/.test(t));
} Type guard
boolean isValidNumberToken(String token) {
return token != null && token.matches("-?\\d+");
} Try / catch
try {
List<Long> numbers = (List<Long>) editor.getConvertedInput();
} catch (ConversionException e) {
error("Each entry must be a whole number; offending value: " + e.getMessage());
} Prevention
- Validate the field client-side with an integer regex before form submission.
- Avoid pasting lists with thousands separators, decimals, or stray commas; clean the text first.
- If decimal values are expected, use a float-capable property type instead of List<Integer>/List<Long>.
- Show an input hint describing the expected format (comma-separated integers).
When it happens
Trigger: A user types a non-numeric token (e.g. 'abc', '1.5' for Integer/Long, '1,000' with thousands separator, or an empty fragment from stray commas/spaces) into a field edited by NumberListEditor and the form converts input.
Common situations: Entering decimal numbers into an integer list field; pasting lists with stray separators or trailing commas; locale-formatted numbers like '1 000' or '1,5'; leaving double commas producing empty tokens.
Related errors
- Invalid issue number: {0}
- Invalid pack ID: {0}
- Invalid pull request number: {0}
- Invalid float value
- Invalid integer value
AI-assisted analysis of theonedev/onedev@d44925c47c (2026-09-06).
Data as JSON: /api/errors/618d01c150e3840c.
Report an issue: GitHub.