{"record":{"id":"69c56f32f529e4eb","repo":"jenkinsci/jenkins","slug":"cannot-build-0-for-unknown-reasons","errorCode":null,"errorMessage":"Cannot build {0} for unknown reasons.","messagePattern":"Cannot build (.+?) for unknown reasons\\.","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 and neither the disabled-check (not a ParameterizedJob or not disabled) nor the hold-off-check (isHoldOffBuildUntilSave is false) matches. The message comes from Messages.BuildCommand_CLICause_CannotBuildUnknownReasons with the job's full display name.","triggerScenarios":"job.isBuildable() is false, the job is not an instance of ParameterizedJobMixIn.ParameterizedJob (or is but isDisabled() returns false), and job.isHoldOffBuildUntilSave() returns false — meaning the job is non-buildable for some other reason not covered by the two checked conditions.","commonSituations":"A Queue.QueueDecisionHandler or similar extension is blocking builds; the job is in a transient state after a restart; a plugin's Job implementation overrides isBuildable() to return false under custom conditions; the job type does not extend ParameterizedJobMixIn and is not in a hold-off state.","solutions":["Check for extensions that may block building: search for implementations of Queue.QueueDecisionHandler or similar veto mechanisms.","Restart Jenkins to clear any transient non-buildable state.","Check the job's configuration for any plugin that might be marking it as non-buildable.","If the job is a custom type, verify its isBuildable() implementation."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// Check buildability with specific reason detection\nif (!job.isBuildable()) {\n    if (job instanceof ParameterizedJobMixIn.ParameterizedJob\n            && ((ParameterizedJobMixIn.ParameterizedJob) job).isDisabled()) {\n        throw new AbortException(job.getFullDisplayName() + \" is disabled. Enable it first.\");\n    } else if (job.isHoldOffBuildUntilSave()) {\n        throw new AbortException(job.getFullDisplayName() + \" configuration has not been saved.\");\n    } else {\n        throw new AbortException(job.getFullDisplayName() + \" is not buildable for an unknown reason. Check extensions and job type.\");\n    }\n}","typeGuard":"public static boolean isBuildable(Job<?, ?> job) {\n    return job.isBuildable();\n}","tryCatchPattern":"try {\n    // build command run()\n} catch (IllegalStateException e) {\n    stderr.println(e.getMessage());\n    stderr.println(\"Check for build-blocking extensions or restart Jenkins.\");\n    return 1;\n}","preventionTips":["Audit installed plugins for Queue.QueueDecisionHandler or similar build-blocking extensions.","Restart Jenkins to clear transient non-buildable states.","Check the job type's isBuildable() implementation for custom logic."],"tags":["cli","build","queue","configuration"],"backgroundTag":null,"analyzedSha":"2e228ff40b14dbc8b14ffbc6edf0e4383cf744fc","analyzedAt":"2026-08-14T07:07:15.274Z","schemaVersion":2},"datasetVersion":"2026-08-14T10:17:34.591Z"}