{"record":{"id":"eee11eb0adabcfa9","repo":"theonedev/onedev","slug":"invalid-issue-id-number","errorCode":null,"errorMessage":"Invalid issue id/number","messagePattern":"Invalid issue id/number","errorType":"validation","errorClass":"ValidationException","httpStatus":null,"severity":"error","filePath":"server-core/src/main/java/io/onedev/server/buildspecmodel/inputspec/IssueChoiceInput.java","lineNumber":34,"sourceCode":"\t\tinputSpec.appendField(buffer, index, \"Long\");\n\t\tinputSpec.appendCommonAnnotations(buffer, index);\n\t\tif (!inputSpec.isAllowEmpty())\n\t\t\tbuffer.append(\"    @NotNull\\n\");\n\t\tbuffer.append(\"    @IssueChoice(useNumber=true)\\n\");\n\t\tinputSpec.appendMethods(buffer, index, \"Long\", null, null);\n\t\t\n\t\treturn buffer.toString();\n\t}\n\n\tpublic static Object convertToObject(List<String> strings) {\n\t\tif (strings.size() == 0) {\n\t\t\treturn null;\n\t\t} else if (strings.size() == 1) {\n\t\t\tString value = strings.iterator().next();\n\t\t\ttry {\n\t\t\t\treturn Long.valueOf(value);\n\t\t\t} catch (NumberFormatException e) {\n\t\t\t\tthrow new ValidationException(\"Invalid issue id/number\");\n\t\t\t}\n\t\t} else {\n\t\t\tthrow new ValidationException(\"Not eligible for multi-value\");\n\t\t}\n\t}\n\n\tpublic static List<String> convertToStrings(Object value) {\n\t\tif (value instanceof Long)\n\t\t\treturn Lists.newArrayList(value.toString());\n\t\telse\n\t\t\treturn new ArrayList<>();\n\t}\n\n}\n","sourceCodeStart":16,"sourceCodeEnd":49,"githubUrl":"https://github.com/theonedev/onedev/blob/d44925c47c37992c828ea673a5f9620539bc3ff2/server-core/src/main/java/io/onedev/server/buildspecmodel/inputspec/IssueChoiceInput.java#L16-L49","documentation":"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').","triggerScenarios":"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).","commonSituations":"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.","solutions":["Enter the numeric issue id/number only (42, not #42).","Use the issue picker UI for the input instead of manual entry.","Fix the job spec default value so its ${...} substitution resolves to a numeric issue id.","Verify the referenced issue exists in the project."],"exampleFix":"// before\nvalue: \"#42\"\n// after\nvalue: \"42\"","handlingStrategy":"validation","validationCode":"// Numeric issue id check before submitting\nif (!/^\\d+$/.test(String(issueValue).replace(/^#/, \"\"))) {\n  throw new Error(\"Issue reference must be a numeric id/number\");\n}","typeGuard":"boolean isNumericIssueRef(Object v) {\n  return v instanceof String && ((String) v).replaceFirst(\"^#\", \"\").matches(\"\\\\d+\");\n}","tryCatchPattern":"try {\n    Object issue = IssueChoiceInput.convertToObject(strings);\n} catch (ValidationException e) {\n    // show \"enter numeric issue id\" hint\n}","preventionTips":["Strip '#' and non-digits from issue numbers before submitting.","Prefer the issue picker UI.","Confirm ${...} defaults resolve to numeric issue ids."],"tags":["validation","issues","input","forms"],"backgroundTag":"invalid-identifier-format","analyzedSha":"d44925c47c37992c828ea673a5f9620539bc3ff2","analyzedAt":"2026-09-06T07:18:27.995Z","contentChangedAt":"2026-09-06T07:18:27.995Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}