{"record":{"id":"5f53c7de42cfbc3a","repo":"jenkinsci/jenkins","slug":"build-number-does-not-exist","errorCode":null,"errorMessage":"Build #{number} does not exist","messagePattern":"Build #(.+?) does not exist","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"core/src/main/java/hudson/cli/SetBuildDisplayNameCommand.java","lineNumber":34,"sourceCode":"    public String getShortDescription() {\n        return Messages.SetBuildDisplayNameCommand_ShortDescription();\n    }\n\n    @Argument(metaVar = \"JOB\", usage = \"Name of the job to build\", required = true, index = 0)\n    public transient Job<?, ?> job;\n\n    @Argument(metaVar = \"BUILD#\", usage = \"Number of the build\", required = true, index = 1)\n    public int number;\n\n    @Argument(metaVar = \"DISPLAYNAME\", required = true, usage = \"DisplayName to be set. '-' to read from stdin.\", index = 2)\n    @SuppressFBWarnings(value = \"PA_PUBLIC_PRIMITIVE_ATTRIBUTE\", justification = \"Preserve API compatibility\")\n    public String displayName;\n\n    @Override\n    protected int run() throws Exception {\n        Run<?, ?> run = job.getBuildByNumber(number);\n        if (run == null) {\n            throw new IllegalArgumentException(\"Build #\" + number + \" does not exist\");\n        }\n        run.checkPermission(Run.UPDATE);\n\n        if (\"-\".equals(displayName)) {\n            displayName = IOUtils.toString(stdin);\n        }\n\n        run.setDisplayName(displayName);\n\n        return 0;\n    }\n}\n","sourceCodeStart":16,"sourceCodeEnd":47,"githubUrl":"https://github.com/jenkinsci/jenkins/blob/2e228ff40b14dbc8b14ffbc6edf0e4383cf744fc/core/src/main/java/hudson/cli/SetBuildDisplayNameCommand.java#L16-L47","documentation":"IllegalArgumentException from set-build-display-name when job.getBuildByNumber(number) returns null. Same guard as set-build-description with a differently worded message.","triggerScenarios":"`set-build-displayname <job> <number> <name>` where build #<number> does not exist for the job.","commonSituations":"Build deleted; number too high; wrong job; keep-log rotation removed the build.","solutions":["Verify the build number against the job's build history.","Use the last build number.","Point at the correct job."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"if (job.getBuildByNumber(number) == null) {\n    throw new IllegalArgumentException(\"Build #\" + number + \" does not exist\");\n}","typeGuard":null,"tryCatchPattern":"catch (IllegalArgumentException e) { /* build number invalid */ }","preventionTips":["Validate the build number against the job's history first.","Beware deleted builds from log rotation."],"tags":["cli","build","not-found"],"backgroundTag":null,"analyzedSha":"2e228ff40b14dbc8b14ffbc6edf0e4383cf744fc","analyzedAt":"2026-08-14T07:07:15.274Z","schemaVersion":2},"datasetVersion":"2026-08-14T10:17:34.591Z"}