{"record":{"id":"04674b282e428e46","repo":"jenkinsci/jenkins","slug":"cannot-build-0-because-it-is-disabled","errorCode":null,"errorMessage":"Cannot build {0} because it is disabled.","messagePattern":"Cannot build (.+?) because it is disabled\\.","errorType":"exception","errorClass":"IllegalStateException","httpStatus":null,"severity":"error","filePath":"core/src/main/java/hudson/cli/BuildCommand.java","lineNumber":164,"sourceCode":"            SCMTriggerItem item = SCMTriggerItem.SCMTriggerItems.asSCMTriggerItem(job);\n            if (item == null)\n                throw new AbortException(job.getFullDisplayName() + \" has no SCM trigger, but checkSCM was specified\");\n            // preemptively check for a polling veto\n            if (SCMDecisionHandler.firstShouldPollVeto(job) != null) {\n                return 0;\n            }\n            if (!item.poll(new StreamTaskListener(stdout, getClientCharset())).hasChanges())\n                return 0;\n        }\n\n        if (!job.isBuildable()) {\n            String msg = Messages.BuildCommand_CLICause_CannotBuildUnknownReasons(job.getFullDisplayName());\n            if (job instanceof ParameterizedJobMixIn.ParameterizedJob && ((ParameterizedJobMixIn.ParameterizedJob) job).isDisabled()) {\n                msg = Messages.BuildCommand_CLICause_CannotBuildDisabled(job.getFullDisplayName());\n            } else if (job.isHoldOffBuildUntilSave()) {\n                msg = Messages.BuildCommand_CLICause_CannotBuildConfigNotSaved(job.getFullDisplayName());\n            }\n            throw new IllegalStateException(msg);\n        }\n\n        Queue.Item item = ParameterizedJobMixIn.scheduleBuild2(job, 0, new CauseAction(new CLICause(Jenkins.getAuthentication2().getName())), a);\n        QueueTaskFuture<? extends Run<?, ?>> f = item != null ? (QueueTaskFuture) item.getFuture() : null;\n\n        if (wait || sync || follow) {\n            if (f == null) {\n                throw new IllegalStateException(BUILD_SCHEDULING_REFUSED);\n            }\n            Run<?, ?> b = f.waitForStart();    // wait for the start\n            stdout.println(\"Started \" + b.getFullDisplayName());\n            stdout.flush();\n\n            if (sync || follow) {\n                try {\n                    if (consoleOutput) {\n                        // read output in a retry loop, by default try only once\n                        // writeWholeLogTo may fail with FileNotFound","sourceCodeStart":146,"sourceCodeEnd":182,"githubUrl":"https://github.com/jenkinsci/jenkins/blob/2e228ff40b14dbc8b14ffbc6edf0e4383cf744fc/core/src/main/java/hudson/cli/BuildCommand.java#L146-L182","documentation":"Thrown as an IllegalStateException when job.isBuildable() returns false specifically because the job is disabled. The condition checks: job instanceof ParameterizedJobMixIn.ParameterizedJob AND ((ParameterizedJobMixIn.ParameterizedJob) job).isDisabled() returns true. The message comes from Messages.BuildCommand_CLICause_CannotBuildDisabled with the job's full display name.","triggerScenarios":"job.isBuildable() returns false; the job is a ParameterizedJobMixIn.ParameterizedJob; isDisabled() returns true.","commonSituations":"Job was manually disabled by an admin via the UI or API; job was disabled by a plugin after repeated build failures; job disabled during maintenance; job disabled as part of a decommissioning process.","solutions":["Re-enable the job: in the Jenkins UI, click the job → 'Enable' button, or use 'jenkins-cli enable-job <name>'.","If disabled by a failure-detection plugin, review and fix the underlying build failures first.","Check the job's config.xml for <disabled>true</disabled> and set it to false if editing manually."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// Check if job is disabled before attempting build\nif (job instanceof ParameterizedJobMixIn.ParameterizedJob\n        && ((ParameterizedJobMixIn.ParameterizedJob) job).isDisabled()) {\n    throw new AbortException(job.getFullDisplayName() + \" is disabled. Use 'enable-job' CLI command or enable via UI.\");\n}","typeGuard":"public static boolean isJobDisabled(Job<?, ?> job) {\n    if (job instanceof ParameterizedJobMixIn.ParameterizedJob) {\n        return ((ParameterizedJobMixIn.ParameterizedJob) job).isDisabled();\n    }\n    return false;\n}","tryCatchPattern":"try {\n    // build command run()\n} catch (IllegalStateException e) {\n    if (e.getMessage().contains(\"disabled\")) {\n        stderr.println(e.getMessage());\n        stderr.println(\"Enable the job first: jenkins-cli enable-job <name>\");\n        return 1;\n    }\n    throw e;\n}","preventionTips":["Check isDisabled() before calling build.","Automate job enable/disable with explicit scripts that track state.","Monitor for plugins that auto-disable jobs after repeated failures."],"tags":["cli","build","configuration","disabled","job"],"backgroundTag":null,"analyzedSha":"2e228ff40b14dbc8b14ffbc6edf0e4383cf744fc","analyzedAt":"2026-08-14T07:07:15.274Z","schemaVersion":2},"datasetVersion":"2026-08-14T10:17:34.591Z"}