theonedev/onedev · error · ValidationException

Invalid issue id/number

Error message

Invalid issue id/number

What it means

IssueChoiceInput converts input strings into issue ids (Long). A single non-numeric value cannot be parsed by Long.valueOf, and the NumberFormatException is rethrown as ValidationException('Invalid issue id/number').

Source

Thrown at server-core/src/main/java/io/onedev/server/buildspecmodel/inputspec/IssueChoiceInput.java:34

		inputSpec.appendField(buffer, index, "Long");
		inputSpec.appendCommonAnnotations(buffer, index);
		if (!inputSpec.isAllowEmpty())
			buffer.append("    @NotNull\n");
		buffer.append("    @IssueChoice(useNumber=true)\n");
		inputSpec.appendMethods(buffer, index, "Long", null, null);
		
		return buffer.toString();
	}

	public static Object convertToObject(List<String> strings) {
		if (strings.size() == 0) {
			return null;
		} else if (strings.size() == 1) {
			String value = strings.iterator().next();
			try {
				return Long.valueOf(value);
			} catch (NumberFormatException e) {
				throw new ValidationException("Invalid issue id/number");
			}
		} else {
			throw new ValidationException("Not eligible for multi-value");
		}
	}

	public static List<String> convertToStrings(Object value) {
		if (value instanceof Long)
			return Lists.newArrayList(value.toString());
		else
			return new ArrayList<>();
	}

}

View on GitHub (pinned to d44925c47c)

Solutions

  1. Enter the numeric issue id/number only (42, not #42).
  2. Use the issue picker UI for the input instead of manual entry.
  3. Fix the job spec default value so its ${...} substitution resolves to a numeric issue id.
  4. Verify the referenced issue exists in the project.

Example fix

// before
value: "#42"
// after
value: "42"
Defensive patterns

Strategy: validation

Validate before calling

// Numeric issue id check before submitting
if (!/^\d+$/.test(String(issueValue).replace(/^#/, ""))) {
  throw new Error("Issue reference must be a numeric id/number");
}

Type guard

boolean isNumericIssueRef(Object v) {
  return v instanceof String && ((String) v).replaceFirst("^#", "").matches("\\d+");
}

Try / catch

try {
    Object issue = IssueChoiceInput.convertToObject(strings);
} catch (ValidationException e) {
    // show "enter numeric issue id" hint
}

Prevention

When it happens

Trigger: convertToObject receives one string for an issue-choice input that is not a valid number (e.g. a string with '#', letters, or a partial issue title).

Common situations: Typing '#42' or an issue key instead of the numeric id; a default value template that failed to resolve and passed through literal text; copying a value from a URL that contained extra path segments.

Understand the failure class

Background: "invalid id" errors: invalid identifier format — why libraries reject IDs before lookup, and how to fix them — this error's family across 37 libraries.

Related errors


AI-assisted analysis of theonedev/onedev@d44925c47c (2026-09-06). Data as JSON: /api/errors/eee11eb0adabcfa9. Report an issue: GitHub.