Jenkinsfile syntax, Groovy & CPS errors
π₯ Learn this hands-on with DevOps Shack β YouTube @devopsshack Β· Hindi @shackverse Β· Courses at devopsshack.com
Q1 WorkflowScript: 1: Missing required section "agent" @ line 1, column 1.
Beginner
WorkflowScript: 1: Missing required section "agent" @ line 1, column 1.Likely causes β The declarative pipeline {} block has no top-level agent, or it was put inside stages.
Diagnose β
curl -s -X POST -u alice:$TOKEN -F "jenkinsfile=<Jenkinsfile" https://jenkins/pipeline-model-converter/validateFix β Add agent any, agent none (with per-stage agents) or a specific agent directly under pipeline {.
Prevent β Lint Jenkinsfiles in a pre-commit hook or PR check with the validate endpoint.
Q2 Unknown stage section "step". Starting with version 0.5, steps in a stage must be in a βstepsβ block.
Beginner
Unknown stage section "step". Starting with version 0.5, steps in a stage must be in a βstepsβ block.Likely causes β Typo step {} instead of steps {}, or steps written directly in the stage block.
Diagnose β The message includes line and column; open the Jenkinsfile there.
Fix β
stage('Build') { steps { sh 'make' } }Prevent β Use the Declarative Directive Generator and an editor plugin with Jenkinsfile linting.
Q3 java.lang.NoSuchMethodError: No such DSL method 'withSonarQubeEnv' found among steps [archive, bat, build, ...]
Beginner
java.lang.NoSuchMethodError: No such DSL method 'withSonarQubeEnv' found among steps [archive, bat, build, ...]Likely causes β The plugin providing the step (SonarQube Scanner) is not installed or failed to load, or the step name is misspelled.
Diagnose β
curl -s -u admin:$TOKEN "https://jenkins/pluginManager/api/json?depth=1&tree=plugins[shortName,active,enabled]" | jq '.plugins[] | select(.shortName=="sonar")'Check Manage Jenkins > Plugins > Installed and startup logs for load failures.
Fix β Add sonar to plugins.txt, rebuild the image, redeploy. Fix spelling if it is a typo.
Prevent β Keep a smoke pipeline that calls every step your library relies on, run after each image change.
Q4 java.io.NotSerializableException: java.util.regex.Matcher
Advanced
java.io.NotSerializableException: java.util.regex.MatcherLikely causes β A Matcher from =~ is held in a variable while a step (sh, echo) runs, and CPS tries to serialize it.
Diagnose β The stack trace shows the variable's location in WorkflowScript or the library class.
Fix β
@NonCPS
String extractVersion(String s) {
def m = (s =~ /version=(\S+)/)
m ? m[0][1] : null
}Or use s.find(/version=(\S+)/) { full, v -> v } and don't keep the matcher.
Prevent β Rule in code review: no Matcher, LazyMap or iterators in pipeline variables.
Q5 java.io.NotSerializableException: groovy.json.internal.LazyMap
Intermediate
java.io.NotSerializableException: groovy.json.internal.LazyMapLikely causes β new JsonSlurper().parseText(...) returns a LazyMap, which is not serializable, and it is alive across a step.
Diagnose β Search the Jenkinsfile and library for JsonSlurper.
Fix β Use Pipeline Utility Steps: def data = readJSON text: response (returns serializable JSONObject), or JsonSlurperClassic inside a @NonCPS method returning plain maps.
Prevent β Standardize on readJSON/readYaml in the library.
Q6 org.jenkinsci.plugins.scriptsecurity.sandbox.RejectedAccessException: Scripts not permitted to use method groovy.lang.GroovyObject invokeMethod java.lang.String java.lang.Object
Intermediate
org.jenkinsci.plugins.scriptsecurity.sandbox.RejectedAccessException: Scripts not permitted to use method groovy.lang.GroovyObject invokeMethod java.lang.String java.lang.ObjectLikely causes β Sandbox blocks a dynamic method call, often from calling a method on an untyped object in an untrusted library, or a misspelled method name that Groovy resolves dynamically.
Diagnose β Look at the line in the stack trace; check In-process Script Approval for the pending signature.
Fix β Fix the typo or type the variable. Do not approve invokeMethod generically; it allows calling any method. Move logic to a trusted library if it legitimately needs it.
Prevent β Unit test library code with JenkinsPipelineUnit and run test pipelines in the sandbox.
Q7 groovy.lang.MissingPropertyException: No such property: IMAGE_TAG for class: groovy.lang.Binding
Beginner
groovy.lang.MissingPropertyException: No such property: IMAGE_TAG for class: groovy.lang.BindingLikely causes β A variable referenced in Groovy that was never defined, a def variable declared in another script {} block (local scope), or an env var accessed without env..
Diagnose β Find where IMAGE_TAG should be set; check whether it was a def inside a different block.
Fix β Set env.IMAGE_TAG = ... and read env.IMAGE_TAG, or declare the variable above the pipeline {} block.
Prevent β Prefer env. for cross-stage values; avoid relying on undeclared binding variables.
Q8 WorkflowScript: 14: Environment variable values must either be single quoted, double quoted, or function calls.
Beginner
WorkflowScript: 14: Environment variable values must either be single quoted, double quoted, or function calls.Likely causes β An unquoted value or expression in environment {}, e.g. TAG = env.BRANCH_NAME + '-x' or COUNT = 3.
Diagnose β Line 14 of the Jenkinsfile.
Fix β Use a GString: TAG = "${env.BRANCH_NAME}-x", or compute in a script {} block with env.TAG = ....
Prevent β Keep environment for static strings and credentials(); compute dynamic values in a dedicated stage.
Q9 WorkflowScript: 22: Invalid condition "sucess" - valid conditions are [always, changed, fixed, regression, aborted, success, unsuccessful, unstable, failure, notBuilt, cleanup]
Beginner
WorkflowScript: 22: Invalid condition "sucess" - valid conditions are [always, changed, fixed, regression, aborted, success, unsuccessful, unstable, failure, notBuilt, cleanup]Likely causes β Typo in a post condition.
Diagnose β The error lists valid names; compare with line 22.
Fix β post { success { ... } }.
Prevent β Linting in PR checks catches it before merge.
Q10 General error during class generation: Method code too large!
Advanced
General error during class generation: Method code too large!Likely causes β The declarative pipeline compiles to a method exceeding 64 KB of bytecode: too many stages, huge matrix, long inline scripts.
Diagnose β Count stages and inline script length; recent large additions are the trigger.
Fix β Move inline shell to files, extract stages into library steps, enable SCRIPT_SPLITTING_TRANSFORMATION=true system property, split into multiple jobs.
Prevent β Keep Jenkinsfiles short by policy (template plus parameters).
Q11 expected to call java.util.ArrayList.each but wound up catching org.jenkinsci.plugins.workflow.cps.CpsClosure2.call; see: https://jenkins.io/redirect/pipeline-cps-method-mismatches/
Advanced
expected to call java.util.ArrayList.each but wound up catching org.jenkinsci.plugins.workflow.cps.CpsClosure2.call; see: https://jenkins.io/redirect/pipeline-cps-method-mismatches/Likely causes β A CPS-transformed closure is called from non-CPS code: e.g. a closure passed to a Java method, toString() override, constructor or @NonCPS method invoking a CPS closure.
Diagnose β Find the call site from the stack trace; check for closures passed to sort, Comparator, inject, or used inside @NonCPS methods.
Fix β Replace with a plain for loop in CPS code, or make the whole helper @NonCPS without calling steps inside.
Prevent β Keep @NonCPS helpers pure (no steps, no CPS closures).
Q12 hudson.AbortException: script returned exit code 127
Beginner
hudson.AbortException: script returned exit code 127Likely causes β Command not found in the container or agent where sh ran: running in jnlp instead of the tool container, wrong image, missing PATH.
Diagnose β
sh 'echo $PATH; which node || true; cat /etc/os-release'Check whether the step is inside container('node') or a defaultContainer is set.
Fix β Wrap with container('node') { }, set defaultContainer, or use an image that has the tool.
Prevent β Standard pod templates per stack in the shared library.
Q13 Warning: A secret was passed to "sh" using Groovy String interpolation, which is insecure. Affected argument(s) used the following variable(s): [NEXUS_PSW]
Intermediate
Warning: A secret was passed to "sh" using Groovy String interpolation, which is insecure. Affected argument(s) used the following variable(s): [NEXUS_PSW]Likely causes β Double-quoted sh "... ${NEXUS_PSW} ..." interpolates the secret in Groovy.
Diagnose β The warning names the variable; search for it in double-quoted strings.
Fix β
sh 'curl -u "$NEXUS_USR:$NEXUS_PSW" https://nexus/...'If you also need Groovy variables, pass them through withEnv and keep single quotes.
Prevent β Lint rule in library CI: no ${...PSW} or ${...TOKEN} in double-quoted sh.
Q14 A when { branch 'main' } stage is always skipped, even on main. The job is a plain Pipeline, not multibranch.
Intermediate
when { branch 'main' } stage is always skipped, even on main. The job is a plain Pipeline, not multibranch.Likely causes β branch condition reads BRANCH_NAME, which only multibranch jobs set. Plain Pipeline jobs don't have it (GIT_BRANCH is origin/main).
Diagnose β
sh 'env | sort | grep -E "BRANCH|GIT_"'Fix β Convert to multibranch (recommended), or use when { expression { env.GIT_BRANCH == 'origin/main' } }.
Prevent β Use multibranch for any repo-driven pipeline.
Q15 The build is aborted with Cancelling nested steps due to timeout during a test stage that normally takes 5 minutes.
Intermediate
Cancelling nested steps due to timeout during a test stage that normally takes 5 minutes.Likely causes β Stage timeout hit because tests hung (waiting on a network resource, deadlock) or because the timeout includes waiting for the agent pod to start.
Diagnose β Check timestamps (timestamps()), when the agent became available, and the last log lines before the timeout; take a thread dump in the test container if reproducible.
Fix β Fix the hang (add test-level timeouts, mock external calls). Put timeout inside the stage steps (not stage options) if pod startup time should not count.
Prevent β Test framework timeouts plus pipeline timeouts as a backstop.
Q16 Scripts not permitted to use method org.jenkinsci.plugins.workflow.support.steps.build.RunWrapper getRawBuild
Intermediate
Scripts not permitted to use method org.jenkinsci.plugins.workflow.support.steps.build.RunWrapper getRawBuildLikely causes β Pipeline calls currentBuild.rawBuild to access the internal Run object, which is blocked by the sandbox.
Diagnose β Search for rawBuild usage.
Fix β Use the safe RunWrapper API: currentBuild.getBuildCauses(), currentBuild.changeSets, currentBuild.previousBuild.result. Do not approve getRawBuild; it exposes the full internal API.
Prevent β Provide library steps for common needs (causes, changes, previous result).
Q17 Steps after input never run, and the log shows Aborted by anonymous after a few minutes.
Intermediate
input never run, and the log shows Aborted by anonymous after a few minutes.Likely causes β The surrounding timeout expired; timeouts abort as SYSTEM/anonymous. Sometimes a reverse proxy breaks the approval POST.
Diagnose β Check the timeout around the input and the time the build waited. Check browser dev tools if users report clicking "Proceed" with no effect.
Fix β Increase the timeout to match the approval SLA; notify approvers when the gate opens (Slack with the build URL).
Prevent β Explicit timeout and notification in the template's approval stage.
Q18 ERROR: Unable to find Jenkinsfile / Lightweight checkout support not available, falling back to full checkout. followed by a failure
Beginner
ERROR: Unable to find Jenkinsfile / Lightweight checkout support not available, falling back to full checkout. followed by a failureLikely causes β The configured Script Path does not match the file location or case (jenkinsfile vs Jenkinsfile), or the branch spec contains variables.
Diagnose β Check job config Script Path and git ls-files | grep -i jenkinsfile on the branch.
Fix β Correct the path/case; use a literal branch spec or multibranch.
Prevent β Standard Jenkinsfile at repo root, or a documented path per monorepo service.
Q19 java.lang.IllegalArgumentException: Unsupported parameter type for sh or No signature of method: sh() is applicable for argument types: (java.lang.String, java.lang.Boolean)
Beginner
java.lang.IllegalArgumentException: Unsupported parameter type for sh or No signature of method: sh() is applicable for argument types: (java.lang.String, java.lang.Boolean)Likely causes β Wrong step argument style: positional arguments mixed with named ones, e.g. sh('ls', true).
Diagnose β Check the Snippet Generator for the step's parameter names.
Fix β Use named parameters: sh(script: 'ls', returnStdout: true).
Prevent β Generate unfamiliar step syntax from the Snippet Generator.
Q20 A library class call fails with unable to resolve class com.devopsshack.ImageTag
Intermediate
unable to resolve class com.devopsshack.ImageTagLikely causes β Library not loaded before the import, wrong package path (src/com/devopsshack/ImageTag.groovy must declare package com.devopsshack), library loaded with the dynamic library step (no compile-time import), or a typo.
Diagnose β Check the log for Loading library shack-lib@v1 and browse the library tag for the file path.
Fix β Use @Library('shack-lib@v1') import com.devopsshack.ImageTag at the top, align package declaration and folders, or access via library('shack-lib@v1').com.devopsshack.ImageTag.
Prevent β JenkinsPipelineUnit tests that load classes from src/.
Agents, executors & the queue
π₯ Learn this hands-on with DevOps Shack β YouTube @devopsshack Β· Hindi @shackverse Β· Courses at devopsshack.com
Q21 Build stuck: Still waiting to schedule task. βJenkinsβ doesnβt have label βdockerβ
Beginner
Still waiting to schedule task. βJenkinsβ doesnβt have label βdockerβLikely causes β No node or pod template has the label docker; the label is misspelled; the agent with that label was removed.
Diagnose β
curl -s -u admin:$TOKEN "https://jenkins/computer/api/json?tree=computer[displayName,offline,assignedLabels[name]]" | jqAlso check Manage Jenkins > Clouds pod template labels.
Fix β Add the label to the right node or pod template, or fix the Jenkinsfile label expression.
Prevent β Keep labels documented and managed in JCasC.
Q22 Waiting for next available executor on βlinuxβ for 20 minutes during peak hours
Beginner
Waiting for next available executor on βlinuxβ for 20 minutes during peak hoursLikely causes β All executors on matching nodes are busy, or the cloud has hit its concurrency cap.
Diagnose β Check Build Executor Status and Load Statistics for the label; for clouds, check the cap versus running pods: kubectl -n jenkins-agents get pods | wc -l.
Fix β Add capacity (more agents or higher cloud cap and quota), reduce waste (abortPrevious, skip unchanged), stagger cron jobs.
Prevent β Alert on queue wait time and review capacity monthly.
Q23 All nodes of label βwindowsβ are offline
Beginner
All nodes of label βwindowsβ are offlineLikely causes β Windows agent service stopped, VM down, agent secret changed, or network/proxy blocking the connection.
Diagnose β Node page shows the offline reason; on the VM check the service status and <workDir>\remoting\logs\remoting.log.0.
Fix β Restart the agent service; if the secret changed (node recreated), update it in the service config; open the connection path (WebSocket over 443).
Prevent β Monitor agent online status and auto-restart the service.
Q24 hudson.remoting.ChannelClosedException: Channel "hudson.remoting.Channel@6e4b:agent-07": Remote call on agent-07 failed. The channel is closing down or has closed down
Intermediate
hudson.remoting.ChannelClosedException: Channel "hudson.remoting.Channel@6e4b:agent-07": Remote call on agent-07 failed. The channel is closing down or has closed downLikely causes β The agent process died (OOM-killed, pod evicted, VM rebooted), or the network connection dropped (idle timeout on a load balancer or proxy).
Diagnose β Check the agent host: dmesg | grep -i kill, kubectl describe pod (OOMKilled, Evicted), proxy timeouts; agent remoting logs.
Fix β Give the agent/pod more memory, fix eviction causes (ephemeral storage limits), raise LB idle timeouts or rely on WebSocket ping.
Prevent β retry(conditions: [agent(), kubernetesAgent()]) around stages to survive occasional agent loss.
Q25 Inbound agent fails: SEVERE: http://jenkins:8080/tcpSlaveAgentListener/ is invalid: 404 Not Found
Intermediate
SEVERE: http://jenkins:8080/tcpSlaveAgentListener/ is invalid: 404 Not FoundLikely causes β The TCP agent port is disabled on the controller, and the agent was started without -webSocket, or the URL is wrong (missing context path).
Diagnose β Check Manage Jenkins > Security > Agents (TCP port) and the agent command line.
Fix β Start the agent with -webSocket (preferred), or enable the TCP port (fixed 50000) and open it.
Prevent β Standardize on WebSocket agents in all templates and docs.
Q26 Agent connects but builds fail with java.io.IOException: Cannot run program "nohup" (in directory "C:\jenkins\workspace\app"): CreateProcess error=2
Beginner
java.io.IOException: Cannot run program "nohup" (in directory "C:\jenkins\workspace\app"): CreateProcess error=2Likely causes β A sh step is running on a Windows agent.
Diagnose β Check which node ran the step (NODE_NAME) and the label used.
Fix β Use bat or powershell on Windows, or branch with if (isUnix()) { sh ... } else { bat ... }; fix label expressions so Linux steps go to Linux agents.
Prevent β Explicit OS labels on every agent and in every pipeline.
Q27 Building on the built-in node can be a security issue. You should set up distributed builds. warning, and some jobs still run there
Beginner
Building on the built-in node can be a security issue. You should set up distributed builds. warning, and some jobs still run thereLikely causes β The built-in node still has executors; jobs with agent any land on it.
Diagnose β Nodes > Built-In Node > Configure shows executors; check recent builds' NODE_NAME.
Fix β Set numExecutors: 0 in JCasC, and ensure there are agents for jobs that used agent any.
Prevent β JCasC enforces it on every restart.
Q28 Builds on a static agent fail with No space left on device in the workspace
Intermediate
No space left on device in the workspaceLikely causes β Workspaces from hundreds of branch jobs and @tmp/@2 copies accumulate; Docker images and build caches fill the disk.
Diagnose β
df -h /home/jenkins
du -sh /home/jenkins/agent/workspace/* | sort -h | tail
docker system dfFix β Delete old workspaces, docker system prune -af --filter until=72h, add cleanWs() in post { cleanup {} }.
Prevent β Disk space monitor threshold on the node (marks it offline), ephemeral agents.
Q29 Node marked offline: Disk space is below threshold of 1.00 GiB. Only 812.33 MiB out of 1.00 GiB left on /tmp.
Beginner
Disk space is below threshold of 1.00 GiB. Only 812.33 MiB out of 1.00 GiB left on /tmp.Likely causes β The node monitor found low free space on the temp directory or workspace partition, and took the node offline to protect builds.
Diagnose β df -h /tmp on the agent; find large files with du -xh /tmp | sort -h | tail.
Fix β Clean up /tmp (stale build tool caches, test outputs), then Bring this node back online. Point java.io.tmpdir to a larger disk if needed.
Prevent β Cron cleanup on static agents; prefer ephemeral agents.
Q30 A pipeline stage shows Waiting for agent to connect (30/100): shack-app-main-12-x7k2p-9q8wz and eventually fails
Intermediate
Waiting for agent to connect (30/100): shack-app-main-12-x7k2p-9q8wz and eventually failsLikely causes β The pod started but the jnlp container cannot reach the controller (wrong Jenkins URL, NetworkPolicy, DNS), or the pod is stuck Pending/ImagePullBackOff.
Diagnose β
kubectl -n jenkins-agents get pod shack-app-main-12-x7k2p-9q8wz -o wide
kubectl -n jenkins-agents describe pod shack-app-main-12-x7k2p-9q8wz
kubectl -n jenkins-agents logs shack-app-main-12-x7k2p-9q8wz -c jnlpFix β Correct jenkinsUrl (e.g. http://jenkins.jenkins.svc.cluster.local:8080/), enable WebSocket, allow egress to the Jenkins service in NetworkPolicy, fix image names.
Prevent β Smoke pipeline after any cloud or network change.
Q31 Builds randomly fail with Agent shack-app-pr-7-abc was deleted; cancelling node body
Intermediate
Agent shack-app-pr-7-abc was deleted; cancelling node bodyLikely causes β The pod was deleted underneath the build: node scale-down by the cluster autoscaler, eviction due to memory/ephemeral storage, spot/preemptible node reclaim, or activeDeadlineSeconds.
Diagnose β kubectl get events -n jenkins-agents --sort-by=.lastTimestamp, autoscaler logs, node termination events.
Fix β Add cluster-autoscaler.kubernetes.io/safe-to-evict: "false" annotation to agent pods, set proper requests/limits, avoid spot nodes for long builds or add retry(conditions: [kubernetesAgent()]).
Prevent β Separate node pool for agents with tuned autoscaler settings.
Q32 Builds are stuck in the queue with There are no nodes with the label βmavenβ but the pod template with label maven exists.
Intermediate
There are no nodes with the label βmavenβ but the pod template with label maven exists.Likely causes β The cloud is at its concurrency limit, the template's instance cap is reached, the cloud's connection to the API server is failing, or the template is restricted to certain jobs/folders.
Diagnose β Manage Jenkins > Clouds > kubernetes > Test Connection; controller log for KubernetesCloud errors; count running pods vs caps.
Fix β Fix credentials/API connectivity, raise caps, remove unintended restrictions.
Prevent β Alert on Kubernetes plugin provisioning errors.
Q33 A static agent takes builds then fails java.lang.UnsupportedClassVersionError: hudson/remoting/Launcher has been compiled by a more recent version of the Java Runtime (class file version 61.0)
Intermediate
java.lang.UnsupportedClassVersionError: hudson/remoting/Launcher has been compiled by a more recent version of the Java Runtime (class file version 61.0)Likely causes β The agent runs an older Java (11 = class file 55) while agent.jar requires Java 17 (61).
Diagnose β java -version on the agent and the Java path used by the launcher (SSH launcher's JavaPath setting).
Fix β Install JDK 17 or 21 on the agent and point the launcher at it; build tools can still use another JDK via tools or JAVA_HOME in the build.
Prevent β Bake agent images/VMs with the supported Java; check before core upgrades.
Q34 SSH agent launch fails: [SSH] Opening SSH connection to 10.0.4.12:22. ... Server rejected the 1 private key(s) for jenkins (credentialId:agent-ssh/method:publickey)
Intermediate
[SSH] Opening SSH connection to 10.0.4.12:22. ... Server rejected the 1 private key(s) for jenkins (credentialId:agent-ssh/method:publickey)Likely causes β Public key not in the agent user's authorized_keys, wrong user, bad file permissions, or key type disabled by the server.
Diagnose β On the agent: ls -la ~jenkins/.ssh, journalctl -u ssh for the rejection reason; test from the controller with the same key.
Fix β Add the key, fix permissions (700 ~/.ssh, 600 authorized_keys), use an ed25519 or RSA key the server accepts.
Prevent β Provision agents with configuration management and keep the key in JCasC credentials.
Q35 SSH agent: Host key verification failed. or No entry currently exists in the Known Hosts file for this host
Intermediate
Host key verification failed. or No entry currently exists in the Known Hosts file for this hostLikely causes β Host key verification strategy is "Known hosts file" and the agent's key is not in the controller's known_hosts, or the agent was rebuilt with a new host key.
Diagnose β Check the node's Host Key Verification Strategy and ~jenkins/.ssh/known_hosts on the controller.
Fix β Add the new key (ssh-keyscan -t ed25519 10.0.4.12 >> known_hosts after verifying it out of band) or use "Manually provided key" in the node config.
Prevent β Manage host keys as code; do not use "Non verifying" strategy.
SCM, multibranch & webhooks
π₯ Learn this hands-on with DevOps Shack β YouTube @devopsshack Β· Hindi @shackverse Β· Courses at devopsshack.com
Q36 ERROR: Couldn't find any revision to build. Verify the repository and branch configuration for this job.
Beginner
ERROR: Couldn't find any revision to build. Verify the repository and branch configuration for this job.Likely causes β The branch specifier does not match any branch (*/master on a repo that uses main), the refspec excludes it, or the credential cannot see the repo.
Diagnose β Run git ls-remote https://github.com/org/repo.git with the same credential; compare with the job's branch spec.
Fix β Set the branch spec to */main (or use multibranch so branches are discovered).
Prevent β Avoid single-branch Pipeline jobs for repos; use multibranch.
Q37 stderr: fatal: could not read Username for 'https://github.com': No such device or address
Beginner
stderr: fatal: could not read Username for 'https://github.com': No such device or addressLikely causes β HTTPS clone of a private repo without credentials, or the credential ID is not set/visible to the job.
Diagnose β Check the SCM config credential field and whether the credential is in a folder the job can access.
Fix β Select a valid credential (GitHub App or username/token) in the SCM or branch source config.
Prevent β Define branch sources with credentials in Job DSL so none are missing.
Q38 Checkout fails with No ED25519 host key is known for github.com and you have requested strict checking.
Intermediate
No ED25519 host key is known for github.com and you have requested strict checking.Likely causes β SSH clone and the Git Host Key Verification setting is "Known hosts file" but GitHub's key is not in known_hosts of the agent/controller.
Diagnose β Manage Jenkins > Security > Git Host Key Verification Configuration.
Fix β Use "Manually provided keys" with GitHub's published keys (from https://api.github.com/meta), or switch to HTTPS with a GitHub App.
Prevent β Set the strategy and keys in JCasC (security.gitHostKeyVerificationConfiguration).
Q39 GitHub webhook deliveries show 302 or 404 and builds do not start
Beginner
302 or 404 and builds do not startLikely causes β Missing trailing slash (/github-webhook redirects), wrong path (/github-webhook/ is for the GitHub plugin; generic webhooks use different endpoints), or the reverse proxy rewrites the request.
Diagnose β GitHub repo Settings > Webhooks > Recent Deliveries: response code and body.
Fix β Payload URL https://jenkins.example.com/github-webhook/ with trailing slash, content type application/json; check the proxy forwards POST bodies.
Prevent β Manage webhooks via an org-level hook or GitHub App with a documented URL.
Q40 Webhook deliveries return 200 but nothing builds
Advanced
200 but nothing buildsLikely causes β Jenkins received the event but no job matches: repository URL in the job differs (.git suffix, SSH vs HTTPS, different case), the job is a plain Pipeline without "GitHub hook trigger for GITScm polling", or the event type is not handled.
Diagnose β Manage Jenkins > System Log, add a recorder for org.jenkinsci.plugins.github and jenkins.scm.api at FINE; check the multibranch Events log.
Fix β Make the job's repo URL match; enable the trigger for non-multibranch jobs; ensure GitHub server config in Jenkins matches the API URL.
Prevent β Prefer multibranch with GitHub Branch Source where event matching is automatic.
Q41 Multibranch scan log: βJenkinsfileβ not found and Does not meet criteria for a branch that has a Jenkinsfile
Intermediate
βJenkinsfileβ not found and Does not meet criteria for a branch that has a JenkinsfileLikely causes β Wrong case or path, the file was added after the last scan, the credential lacks access to file contents, or a branch filter excludes it.
Diagnose β Read Scan Repository Log; confirm path with git ls-tree -r origin/<branch> --name-only | grep -i jenkinsfile.
Fix β Correct the Script Path or file name; re-run Scan Repository Now.
Prevent β Webhooks for push events so new files trigger re-indexing.
Q42 GitHub API Usage: Current quota for Github API usage has 4 remaining (1 over budget). Next quota of 5000 in 38 min. Sleeping for 37 min.
Intermediate
GitHub API Usage: Current quota for Github API usage has 4 remaining (1 over budget). Next quota of 5000 in 38 min. Sleeping for 37 min.Likely causes β Many multibranch scans with a personal token, frequent periodic scans, organization folders scanning hundreds of repos.
Diagnose β Scan logs show rate limit messages; check scan intervals across folders.
Fix β Switch to a GitHub App credential (higher, per-installation limits), reduce periodic scans to daily, rely on webhooks, choose the "Throttle at/near rate limit" API usage strategy.
Prevent β Credential choice and scan intervals standardized in Job DSL.
Q43 PR builds show the wrong code: a fix pushed to the target branch is missing in PR merge builds
Advanced
Likely causes β The merge build uses the target revision recorded at indexing time; the PR was not re-indexed after the target changed, or "Discover pull requests" uses the head strategy.
Diagnose β Check build log for Merging remotes/origin/main commit <sha> and compare with the current main head.
Fix β Re-run the PR build after a scan; enable rebuilding PRs when the target branch changes (GitHub Branch Source can trigger on target changes if events are delivered) or rebase the PR.
Prevent β Merge queue or require branches to be up to date in branch protection.
Q44 Branch jobs disappear unexpectedly after a scan
Intermediate
Likely causes β The orphaned item strategy removed them because the scan temporarily failed to list branches (expired credential, API outage) or a filter change excluded them.
Diagnose β Scan log for errors and Will remove ... lines; check credential validity.
Fix β Fix the credential/filter and re-scan; restored branches recreate jobs, but build history of deleted jobs is gone unless restored from backup.
Prevent β Abort scans on errors (default behaviour for most sources), keep backups, monitor credential expiry.
Q45 ERROR: Could not find any definition of libraries [shack-lib]
Beginner
ERROR: Could not find any definition of libraries [shack-lib]Likely causes β The library name in @Library does not match any configured global or folder library, or the job is outside the folder where the library is defined.
Diagnose β Check Manage Jenkins > System > Global Trusted Pipeline Libraries and the folder's library config.
Fix β Configure the library (JCasC unclassified.globalLibraries) or fix the name.
Prevent β Library configuration in JCasC; document the exact name.
Q46 ERROR: Version override not permitted for library shack-lib
Beginner
ERROR: Version override not permitted for library shack-libLikely causes β The Jenkinsfile requests @Library('shack-lib@feature-x') but the library config has "Allow default version to be overridden" disabled.
Diagnose β Library config in Manage Jenkins or JCasC (allowVersionOverride: false).
Fix β Use the default version, or test the branch via a folder-level library or staging controller.
Prevent β Document how to test library branches safely.
Q47 ERROR: Library shack-lib expected to contain at least one of src or vars directories
Beginner
ERROR: Library shack-lib expected to contain at least one of src or vars directoriesLikely causes β The retriever points to the wrong repo, branch or subdirectory; the library files are nested (e.g. under jenkins/) without setting the library path.
Diagnose β Browse the configured version in Git and check top-level folders.
Fix β Fix the repo URL/version, or set Library Path (libraryPath: 'jenkins/' in modernSCM) for libraries in a subfolder.
Prevent β Keep libraries in dedicated repos with vars/ and src/ at the root.
Q48 Builds start twice for each push: once as main and once as a pull request, plus once from polling
Beginner
main and once as a pull request, plus once from pollingLikely causes β pollSCM trigger in the Jenkinsfile plus webhooks, and branch discovery set to "All branches" with PR discovery.
Diagnose β Build causes (Started by an SCM change, Branch indexing, Push event to branch main).
Fix β Remove pollSCM when webhooks work; set branch discovery to exclude branches filed as PRs.
Prevent β Template-level conventions and review for triggers.
Q49 hudson.plugins.git.GitException: Command "git fetch --tags --force --progress -- https://github.com/org/big-repo.git +refs/heads/*:refs/remotes/origin/*" returned status code 128: ... timeout after 10 minutes
Intermediate
hudson.plugins.git.GitException: Command "git fetch --tags --force --progress -- https://github.com/org/big-repo.git +refs/heads/*:refs/remotes/origin/*" returned status code 128: ... timeout after 10 minutesLikely causes β Huge repository (history, binaries) or slow network; default 10-minute clone/fetch timeout.
Diagnose β Repo size (git count-objects -vH on a local clone), network throughput from agents.
Fix β Use shallow clone (cloneOption(shallow: true, depth: 1, noTags: true, timeout: 30)), narrow refspec to the branch, reference repositories on static agents, Git LFS for binaries.
Prevent β Repo hygiene (no binaries in Git) and a mirror close to the agents.
Q50 Commit statuses never appear on GitHub PRs, even though builds pass
Intermediate
Likely causes β The credential lacks permission to write statuses (PAT without repo:status, GitHub App without "Commit statuses: write" or "Checks: write"), or the job uses a plain Git SCM instead of GitHub Branch Source.
Diagnose β Controller log for GitHubCommitStatusSetter or Could not update commit status errors.
Fix β Grant the permission to the App/token, or use GitHub Branch Source; add githubNotify explicitly if needed.
Prevent β Use a GitHub App with documented permissions for all orgs.
Credentials, permissions & script approval
π₯ Learn this hands-on with DevOps Shack β YouTube @devopsshack Β· Hindi @shackverse Β· Courses at devopsshack.com
Q51 ERROR: Could not find credentials entry with ID 'dockerhub'
Beginner
ERROR: Could not find credentials entry with ID 'dockerhub'Likely causes β The ID is wrong, the credential is in a different folder, or it is System-scoped (not usable by jobs).
Diagnose β Check credentials at global and folder levels; verify scope is Global.
Fix β Move or recreate the credential in the job's folder (or a parent) with Global scope; correct the ID.
Prevent β Define credentials in JCasC with consistent IDs documented in the library.
Q52 API call returns HTTP ERROR 403 No valid crumb was included in the request
Beginner
HTTP ERROR 403 No valid crumb was included in the requestLikely causes β POST with username + password (session-based) without a crumb, or crumb obtained from a different session (no cookie jar), or a proxy changing client IP when crumbs are tied to IP.
Diagnose β Check whether the script uses an API token; inspect whether cookies are kept between the crumb and POST requests.
Fix β Use an API token (no crumb needed), or fetch the crumb with -c cookies and send with -b cookies -H "Jenkins-Crumb: ...".
Prevent β Standardize automation on API tokens for service users.
Q53 Access Denied: alice is missing the Job/Build permission
Beginner
Access Denied: alice is missing the Job/Build permissionLikely causes β Authorization strategy does not grant the permission to Alice or her groups on that job/folder; group names from SSO do not match the configured names.
Diagnose β Check https://jenkins/whoAmI/ while logged in as Alice (shows authorities/groups); compare with the matrix.
Fix β Grant the permission to the right group at the folder level, matching exact group names (case-sensitive for some realms).
Prevent β Manage authorization in JCasC with group names verified against the IdP.
Q54 After enabling SSO, everyone sees alice is missing the Overall/Read permission
Advanced
alice is missing the Overall/Read permissionLikely causes β Permissions were granted to local users or to groups that the new realm does not provide; group claim not configured in the OIDC/SAML settings.
Diagnose β /whoAmI/ shows the authorities from the new realm; check the IdP token claims.
Fix β Configure the groups claim (e.g. groups) in the realm; grant Overall/Read to authenticated and real permissions to IdP groups. Use the break-glass admin to fix if locked out.
Prevent β Test realm changes on staging with real accounts first.
Q55 Locked out: SSO is down and nobody can log in to Jenkins to fix the realm
Advanced
Likely causes β No break-glass account; realm misconfiguration applied.
Diagnose β Confirm IdP status; check controller logs for realm errors.
Fix β If JCasC manages security, fix the YAML (or point to a temporary local realm) and restart/reload. Otherwise, stop Jenkins, edit config.xml setting <useSecurity> to a temporary local realm, start, fix, and revert. As a last resort, a Groovy script in init.groovy.d/ can set a realm at startup.
Prevent β Break-glass local admin in a vault, JCasC-managed security, tested quarterly.
Q56 A pipeline using withCredentials prints **** in places where the secret is not expected, breaking output parsing
Intermediate
withCredentials prints **** in places where the secret is not expected, breaking output parsingLikely causes β The secret value is a short or common string (e.g. admin, 1234) and masking replaces every occurrence in the log.
Diagnose β Check the secret's value length/content.
Fix β Use strong, unique secrets; parse command output from files instead of the console log.
Prevent β Credential policies requiring long random secrets.
Q57 org.jenkinsci.plugins.scriptsecurity.sandbox.RejectedAccessException: Scripts not permitted to use staticMethod org.codehaus.groovy.runtime.DefaultGroovyMethods execute java.lang.String
Intermediate
org.jenkinsci.plugins.scriptsecurity.sandbox.RejectedAccessException: Scripts not permitted to use staticMethod org.codehaus.groovy.runtime.DefaultGroovyMethods execute java.lang.StringLikely causes β Pipeline code uses "ls".execute() to run a process; in pipelines this runs on the controller, not the agent.
Diagnose β Search for .execute().
Fix β Replace with sh(script: 'ls', returnStdout: true). Never approve this signature: it allows arbitrary commands on the controller.
Prevent β Educate pipeline authors that Groovy runs on the controller; review approvals list.
Q58 A job using a credential works when triggered by an admin but fails with CredentialsNotFound-style errors when triggered by an upstream job or a normal user
Advanced
CredentialsNotFound-style errors when triggered by an upstream job or a normal userLikely causes β Authorize Project plugin runs builds as the triggering user, who lacks Credentials/UseItem on that credential; or the credential is user-scoped (stored in the admin's personal store).
Diagnose β Job's Authorization setting and the credential's store (user vs folder).
Fix β Move the credential to the folder store; grant Credentials/UseItem to the group that runs the job, or configure the job to run as a specific service identity.
Prevent β Never use personal credential stores for shared jobs.
Q59 Users can no longer see job descriptions as formatted HTML after a security update
Beginner
Likely causes β Markup formatter changed to Plain text (or HTML sanitized by Safe HTML).
Diagnose β Manage Jenkins > Security > Markup Formatter.
Fix β Use "Safe HTML" (OWASP Markup Formatter) for basic formatting; do not revert to raw HTML.
Prevent β Set the formatter in JCasC (jenkins.markupFormatter: owaspMarkupFormatter).
Q60 Replay button is missing for developers who used to have it
Beginner
Likely causes β Run/Replay permission removed (intentional hardening), or the build was from a pipeline type that does not support replay.
Diagnose β Check the authorization matrix for Run/Replay on the folder.
Fix β Explain the policy; offer a test folder with Replay allowed for experiments, or use PR branches.
Prevent β Document permission changes in the platform changelog.
Q61 Agents fail to connect with Rejected connection: ... is not authorized to connect or the agent secret error Incorrect secret
Intermediate
Rejected connection: ... is not authorized to connect or the agent secret error Incorrect secretLikely causes β The node was deleted and recreated (new secret), the agent uses a stale secret, or the node name differs from -name.
Diagnose β Compare the node name and secret on the node's page with the agent's start command.
Fix β Update the agent with the current secret and exact name; restart the agent.
Prevent β Store agent secrets in a secret store and automate agent registration.
Q62 java.lang.SecurityException: Rejecting unsandboxed script or UnapprovedUsageException: script not yet approved for use
Intermediate
java.lang.SecurityException: Rejecting unsandboxed script or UnapprovedUsageException: script not yet approved for useLikely causes β A pipeline configured with "Use Groovy Sandbox" unchecked (inline script) by a non-admin, so the whole script needs admin approval; or Job DSL scripts with script security enabled.
Diagnose β Job config sandbox checkbox; pending items in In-process Script Approval.
Fix β Enable the sandbox for the job, or have an admin review and approve the whole script (only for trusted content).
Prevent β Pipelines from SCM always use the sandbox; admin-only for unsandboxed scripts.
Plugins, JCasC & Kubernetes agents
π₯ Learn this hands-on with DevOps Shack β YouTube @devopsshack Β· Hindi @shackverse Β· Courses at devopsshack.com
Q63 Startup log: SEVERE: Failed Loading plugin Pipeline: Groovy v... (workflow-cps) with Update required: Pipeline: Supporting APIs (workflow-support) ... to be updated to ... or higher
Intermediate
SEVERE: Failed Loading plugin Pipeline: Groovy v... (workflow-cps) with Update required: Pipeline: Supporting APIs (workflow-support) ... to be updated to ... or higherLikely causes β A plugin was updated but its dependency was not; plugins installed manually without dependency resolution.
Diagnose β Read the full list of failed plugins in the log and Manage Jenkins admin monitor.
Fix β Rebuild the image with jenkins-plugin-cli resolving dependencies (or update the named dependency); restart.
Prevent β Never install plugins via UI on production; use plugins.txt and CI-built images.
Q64 Plugin fails with Jenkins (2.426.3) or higher required
Beginner
Jenkins (2.426.3) or higher requiredLikely causes β The plugin version requires a newer core than the one running.
Diagnose β jenkins-plugin-cli --jenkins-version <your core> --plugin-file plugins.txt --list.
Fix β Pin a plugin version compatible with your core, or upgrade core first.
Prevent β Always pass --jenkins-version when generating plugin updates.
Q65 JCasC fails at startup: io.jenkins.plugins.casc.ConfiguratorException: Invalid configuration elements for type class jenkins.model.Jenkins : agentProtocols
Intermediate
io.jenkins.plugins.casc.ConfiguratorException: Invalid configuration elements for type class jenkins.model.Jenkins : agentProtocolsLikely causes β The YAML uses an attribute that no longer exists in this version (removed setting) or is misspelled/misplaced.
Diagnose β The message names the type and attribute; check the JCasC reference at /configuration-as-code/reference on the running version, or export the current config.
Fix β Remove or rename the attribute to match the current schema.
Prevent β CI that boots the controller image with the JCasC file and fails on ConfiguratorException.
Q66 io.jenkins.plugins.casc.UnknownConfiguratorException: No configurator for the following root elements: sonarGlobalConfiguration
Intermediate
io.jenkins.plugins.casc.UnknownConfiguratorException: No configurator for the following root elements: sonarGlobalConfigurationLikely causes β The element is at the wrong level (must be under unclassified:), or the plugin that provides it is not installed.
Diagnose β Check indentation and the plugin list.
Fix β
unclassified:
sonarGlobalConfiguration:
installations:
- name: sonarqube
serverUrl: http://sonarqube.sonarqube.svc:9000
credentialsId: sonar-tokenPrevent β Use the exported YAML as a template and validate against the JCasC schema.
Q67 JCasC credentials contain the literal text ${GITHUB_TOKEN} instead of the value
Advanced
${GITHUB_TOKEN} instead of the valueLikely causes β The environment variable or secret file was not available to the controller process, so resolution produced the raw string (JCasC logs a warning), or the value was escaped with ^${...}.
Diagnose β kubectl -n jenkins exec jenkins-0 -- printenv GITHUB_TOKEN, check /run/secrets/GITHUB_TOKEN, controller log for Configuration import: Found unresolved variable GITHUB_TOKEN.
Fix β Provide the secret as env (envFrom: secretRef) or a file in the secrets dir; restart/reload.
Prevent β A startup check that fails if unresolved variables are logged.
Q68 Kubernetes plugin: Failure executing: POST at: https://10.96.0.1/api/v1/namespaces/jenkins-agents/pods. Message: pods is forbidden: User "system:serviceaccount:jenkins:jenkins" cannot create resource "pods" in API group "" in the namespace "jenkins-agents".
Beginner
Failure executing: POST at: https://10.96.0.1/api/v1/namespaces/jenkins-agents/pods. Message: pods is forbidden: User "system:serviceaccount:jenkins:jenkins" cannot create resource "pods" in API group "" in the namespace "jenkins-agents".Likely causes β Missing Role/RoleBinding for the controller's service account in the agent namespace.
Diagnose β
kubectl auth can-i create pods -n jenkins-agents --as system:serviceaccount:jenkins:jenkinsFix β Create a Role with pods, pods/exec, pods/log, events permissions in jenkins-agents and bind it to jenkins:jenkins.
Prevent β RBAC in the same Helm chart/manifests as the controller.
Q69 Agent pod events: Failed to pull image "maven:3.9-eclipse-temurin21": manifest unknown and the build log says Unable to pull container image "maven:3.9-eclipse-temurin21". Check if image tag name is spelled correctly.
Beginner
Failed to pull image "maven:3.9-eclipse-temurin21": manifest unknown and the build log says Unable to pull container image "maven:3.9-eclipse-temurin21". Check if image tag name is spelled correctly.Likely causes β Typo in the image tag (temurin21 instead of temurin-21), private image without pull secret, or registry rate limiting (toomanyrequests).
Diagnose β kubectl -n jenkins-agents describe pod <pod>; try crane manifest maven:3.9-eclipse-temurin-21.
Fix β Correct the tag; add imagePullSecrets; mirror images to an internal registry.
Prevent β Central pod templates in the library and a registry mirror.
Q70 process apparently never started in /home/jenkins/agent/workspace/shack-app_main@tmp/durable-3f2a1b9c
Advanced
process apparently never started in /home/jenkins/agent/workspace/shack-app_main@tmp/durable-3f2a1b9cLikely causes β In a container() step, the tool container runs as a different UID than jnlp and cannot write to the @tmp control directory; the image has no /bin/sh or nohup; or the workspace path differs (workingDir mismatch).
Diagnose β Enable launch diagnostics for one run: -Dorg.jenkinsci.plugins.durabletask.BourneShellScript.LAUNCH_DIAGNOSTICS=true on the controller; check id in both containers.
Fix β Run containers with the same UID (pod securityContext.runAsUser: 1000 and fsGroup: 1000), use images with a shell (:debug variants), keep the default working directory /home/jenkins/agent.
Prevent β Base pod template with a consistent security context.
Q71 Build fails with Container [maven] was terminated (Exit Code: 137, Reason: OOMKilled)
Intermediate
Container [maven] was terminated (Exit Code: 137, Reason: OOMKilled)Likely causes β The container's memory limit is lower than the JVM or test suite needs; JVM heap not bounded within the container limit.
Diagnose β kubectl describe pod (Last State: OOMKilled); check MAVEN_OPTS and container limits.
Fix β Raise the memory limit and set MAVEN_OPTS=-XX:MaxRAMPercentage=75 so the JVM respects it; limit Surefire forks (-DforkCount=1).
Prevent β Right-size requests/limits per template from observed usage.
Q72 Pods stay Pending with 0/6 nodes are available: 6 Insufficient cpu. and builds wait
Intermediate
Pending with 0/6 nodes are available: 6 Insufficient cpu. and builds waitLikely causes β Requests too high for available nodes, cluster autoscaler not scaling (max size reached, node group misconfigured), quota limits.
Diagnose β kubectl -n jenkins-agents describe pod, autoscaler logs, kubectl describe resourcequota -n jenkins-agents.
Fix β Lower requests to realistic values, increase node group max, fix autoscaler config.
Prevent β Capacity alerts and realistic requests in templates.
Q73 Agent pod logs (jnlp): java.net.UnknownHostException: jenkins.jenkins.svc.cluster.local
Intermediate
jnlp): java.net.UnknownHostException: jenkins.jenkins.svc.cluster.localLikely causes β Service name or namespace wrong, agents running in another cluster where that DNS name does not exist, or DNS blocked by NetworkPolicy (port 53 to kube-dns).
Diagnose β kubectl -n jenkins get svc; from a debug pod in the agent namespace: nslookup jenkins.jenkins.svc.cluster.local.
Fix β Correct jenkinsUrl; allow DNS egress; for remote clusters use the public HTTPS URL with WebSocket.
Prevent β Include DNS in the agents' NetworkPolicy baseline.
Q74 A container('kaniko') step fails: sh: can't access tty; job control turned off then /busybox/sh: kubectl: not found, or ERROR: Process exited immediately after creation
Intermediate
container('kaniko') step fails: sh: can't access tty; job control turned off then /busybox/sh: kubectl: not found, or ERROR: Process exited immediately after creationLikely causes β The container's main process exits (no sleep/cat command), or a distroless image lacks a shell; the wrong container was targeted.
Diagnose β Check pod status (container terminated), the image entrypoint, and the container name in container().
Fix β Use gcr.io/kaniko-project/executor:debug (includes busybox shell) with command: ["sleep"], args: ["infinity"]; target the correct container for each tool.
Prevent β Reusable templates with a known-good command for each tool image.
Q75 JCasC reload wiped out a manually added cloud and all builds are stuck
Intermediate
Likely causes β JCasC replaces the clouds list with what the YAML contains; the manual cloud was not in Git.
Diagnose β Compare JCasC YAML and the previous UI config (Job Configuration History for system config).
Fix β Add the cloud to JCasC and reload.
Prevent β No manual config on JCasC-managed controllers; announce this rule in the system message.
Q76 After upgrading the kubernetes plugin, pod templates defined with containerTemplate fail with ERROR: Invalid pod template or fields are ignored
Advanced
containerTemplate fail with ERROR: Invalid pod template or fields are ignoredLikely causes β Deprecated fields removed or behaviour changed between plugin versions; YAML merge strategy defaults changed.
Diagnose β Plugin changelog, controller logs at FINE for org.csanchez.jenkins.plugins.kubernetes, the generated pod YAML (printed at build start in the log).
Fix β Migrate to raw yaml pod specs (most stable interface), set yamlMergeStrategy explicitly.
Prevent β Upgrade plugins on staging with smoke pipelines covering each template.
Q77 Job DSL in JCasC fails: ERROR: (script, line 3) No signature of method: javaposse.jobdsl.dsl.helpers.workflow.BranchSourcesContext.github() is applicable
Advanced
ERROR: (script, line 3) No signature of method: javaposse.jobdsl.dsl.helpers.workflow.BranchSourcesContext.github() is applicableLikely causes β Static DSL method not available; GitHub branch source is exposed only through the dynamic DSL (branchSource { source { github { ... } } }), or the plugin is missing.
Diagnose β Check the Job DSL API viewer on your controller (/plugin/job-dsl/api-viewer/index.html) for available methods.
Fix β
branchSources { branchSource { source { github {
id('shack-app'); repoOwner('devopsshack'); repository('shack-app')
repositoryUrl('https://github.com/devopsshack/shack-app'); configuredByUrl(true)
credentialsId('github-app')
} } } }Prevent β Use the API viewer of your own controller as the reference, not internet examples.
Q78 Agents connect but every sh step in container('node') hangs for minutes before running
Advanced
sh step in container('node') hangs for minutes before runningLikely causes β The exec API calls are slow or throttled (API server overloaded, webhook admission controllers on pods/exec), or a proxy between controller and API server buffers the exec stream.
Diagnose β Time kubectl exec manually from the controller pod; check API server latency metrics and admission webhooks.
Fix β Fix API server or webhook latency; as a workaround run steps in the jnlp container by building a custom agent image with the tools.
Prevent β Monitor API server latency; keep exec-heavy pipelines in mind when adding admission webhooks.
Q79 The JCasC page shows Configuration as Code: unable to read /var/jenkins_config/jenkins.yaml after a ConfigMap change
Beginner
Configuration as Code: unable to read /var/jenkins_config/jenkins.yaml after a ConfigMap changeLikely causes β ConfigMap key name changed, mount path changed, or YAML syntax error making the file invalid.
Diagnose β kubectl -n jenkins exec jenkins-0 -- ls -la /var/jenkins_config/; yamllint jenkins.yaml.
Fix β Align CASC_JENKINS_CONFIG with the mounted file; fix the YAML.
Prevent β Lint YAML in CI and keep the path in one place in the manifests.
Q80 Builds fail with java.lang.InterruptedException at random steps and the controller log shows Pod ... was terminated: Reason: Evicted, The node was low on resource: ephemeral-storage
Intermediate
java.lang.InterruptedException at random steps and the controller log shows Pod ... was terminated: Reason: Evicted, The node was low on resource: ephemeral-storageLikely causes β The workspace (emptyDir) and container layers fill the node's ephemeral storage; Kubelet evicts pods.
Diagnose β kubectl get events for evictions; node disk usage.
Fix β Set resources.requests/limits.ephemeral-storage on build containers, use a PVC or larger node disks for heavy builds, clean caches during the build.
Prevent β Size node disks for build workloads; monitor ephemeral storage.
Controller health, disk & upgrades
π₯ Learn this hands-on with DevOps Shack β YouTube @devopsshack Β· Hindi @shackverse Β· Courses at devopsshack.com
Q81 Controller crashes with java.lang.OutOfMemoryError: Java heap space
Intermediate
java.lang.OutOfMemoryError: Java heap spaceLikely causes β Heap too small for the workload, too many retained builds, huge pipelines (many steps), giant logs, or a plugin leak.
Diagnose β Heap dump from -XX:+HeapDumpOnOutOfMemoryError analysed with Eclipse MAT; GC logs; recent plugin changes.
Fix β Short term: restart with more heap (-XX:MaxRAMPercentage=75 and a larger container limit). Then fix the cause: discard old builds, reduce step counts, upgrade/remove the leaking plugin.
Prevent β Alert on heap usage after GC above 80%.
Q82 Controller pod restarts repeatedly: liveness probe failed: Get "http://10.0.3.7:8080/login": context deadline exceeded
Intermediate
Get "http://10.0.3.7:8080/login": context deadline exceededLikely causes β Startup takes longer than the probe allows (many jobs, slow disk), or long GC pauses make /login unresponsive.
Diagnose β kubectl -n jenkins describe pod jenkins-0 events; controller logs around startup; GC logs.
Fix β Add a startupProbe with a generous failureThreshold (e.g. 60 Γ 10 s), keep liveness lenient; fix GC pressure.
Prevent β Measure startup time after each change; keep probes aligned.
Q83 Jenkins UI shows Jenkins is going to shut down and new builds are not starting
Beginner
Jenkins is going to shut down and new builds are not startingLikely causes β Someone (or an upgrade script) triggered Prepare for Shutdown / quiet-down.
Diagnose β Banner in the UI; audit trail for /quietDown.
Fix β Manage Jenkins > Cancel Shutdown or curl -X POST -u admin:$TOKEN https://jenkins/cancelQuietDown.
Prevent β Use quiet-down only in maintenance windows with an announcement.
Q84 JENKINS_HOME volume is 98% full
Beginner
JENKINS_HOME volume is 98% fullLikely causes β Build records and artifacts without retention, orphaned branch jobs, workspaces on the built-in node, heap dumps, logs.
Diagnose β
du -h --max-depth=2 /var/jenkins_home | sort -h | tail -20
find /var/jenkins_home/jobs -name archive -type d -exec du -sh {} + | sort -h | tailFix β Delete old builds via buildDiscarder and a one-off cleanup, remove orphaned jobs, delete stale heap dumps; move artifacts to Nexus/S3.
Prevent β Retention by default in templates; disk alerts at 80%.
Q85 After an upgrade: Running with Java 11, which is older than the minimum required version (Java 17). and Jenkins won't start
Beginner
Running with Java 11, which is older than the minimum required version (Java 17). and Jenkins won't startLikely causes β New core requires Java 17+; the host still runs Java 11.
Diagnose β java -version for the Java used by the service (systemctl cat jenkins for JAVA_HOME).
Fix β Install Java 17 or 21 and point the service at it (JAVA_HOME in the systemd override), or use a jdk21 image tag.
Prevent β Read the LTS upgrade guide; upgrade Java first as a separate change.
Q86 UI is slow and the thread dump shows dozens of threads BLOCKED on hudson.model.Queue
Advanced
BLOCKED on hudson.model.QueueLikely causes β Queue maintenance is slow due to a huge queue, expensive label expressions, or a plugin with slow QueueTaskDispatcher/canTake logic (e.g. throttling plugins evaluating many items).
Diagnose β Several thread dumps a few seconds apart; find the thread holding the queue lock and its stack (plugin package names).
Fix β Reduce queue size (cancel redundant builds), simplify label logic, update or remove the offending plugin.
Prevent β Keep queue-affecting plugins minimal; monitor queue size.
Q87 java.io.IOException: Too many open files in the controller log
Advanced
java.io.IOException: Too many open files in the controller logLikely causes β Low file descriptor limit for the Jenkins process, or a leak from a plugin keeping files/sockets open.
Diagnose β cat /proc/$(pgrep -f jenkins.war)/limits | grep 'open files' and ls /proc/<pid>/fd | wc -l; lsof -p <pid> | awk '{print $9}' | sort | uniq -c | sort -n | tail.
Fix β Raise limits (LimitNOFILE=65536 in systemd, container runtime ulimits); identify leaking files from lsof and update the plugin.
Prevent β Monitor open FDs.
Q88 Builds started before a controller restart show Resuming build at ... then fail with Pausing (Preparing for shutdown) loops or Could not find any running agent
Advanced
Resuming build at ... then fail with Pausing (Preparing for shutdown) loops or Could not find any running agentLikely causes β The agents those builds used (Kubernetes pods) were deleted or did not reconnect after the restart, so the resumed builds cannot continue.
Diagnose β Build log after resume; kubectl get pods in agents namespace; whether quiet-down was used before the restart.
Fix β Abort the stuck builds and rerun. Use quiet-down before planned restarts.
Prevent β Graceful maintenance, retry(conditions: [kubernetesAgent(), nonresumable()]) for idempotent stages.
Q89 After restoring from backup, credentials appear but jobs fail with hudson.util.Secret decryption errors and empty passwords
Advanced
hudson.util.Secret decryption errors and empty passwordsLikely causes β secrets/master.key and secrets/hudson.util.Secret were not restored (or came from a different instance), so stored secrets can't be decrypted.
Diagnose β Compare secrets/ with the original backup; controller log for Failed to decrypt warnings.
Fix β Restore the matching secrets/ directory and restart. If lost, recreate every credential.
Prevent β Back up secrets/ with the rest of JENKINS_HOME, test restores, keep secrets in an external store.
Q90 It appears that your reverse proxy set up is broken. appears in Manage Jenkins and some links point to http://localhost:8080
Beginner
It appears that your reverse proxy set up is broken. appears in Manage Jenkins and some links point to http://localhost:8080Likely causes β Jenkins URL not set or wrong; proxy not forwarding Host/X-Forwarded-* headers.
Diagnose β Manage Jenkins > System > Jenkins URL; proxy config; curl -I https://jenkins.example.com/administrativeMonitor/hudson.diagnosis.ReverseProxySetupMonitor/test.
Fix β Set unclassified.location.url to the external URL; forward X-Forwarded-Proto, X-Forwarded-Host, X-Forwarded-Port.
Prevent β Configure the URL in JCasC and test via the monitor after proxy changes.
Integration failures: SonarQube, Nexus, Docker, Trivy, kubectl
π₯ Learn this hands-on with DevOps Shack β YouTube @devopsshack Β· Hindi @shackverse Β· Courses at devopsshack.com
Q91 java.lang.IllegalStateException: Unable to get SonarQube task id and/or server name. Please use the 'withSonarQubeEnv' wrapper to run your analysis.
Intermediate
java.lang.IllegalStateException: Unable to get SonarQube task id and/or server name. Please use the 'withSonarQubeEnv' wrapper to run your analysis.Likely causes β waitForQualityGate called in a build where the analysis did not run inside withSonarQubeEnv, the analysis ran on another agent and report-task.txt is not found, or analysis failed earlier.
Diagnose β Confirm withSonarQubeEnv('sonarqube') wraps the scanner; look for .scannerwork/report-task.txt (or target/sonar/report-task.txt for Maven).
Fix β Wrap the scanner call with withSonarQubeEnv; run gate in the same build after analysis.
Prevent β Library step that does analysis and gate together.
Q92 waitForQualityGate fails with Timeout has been exceeded though SonarQube shows the analysis as complete
Intermediate
waitForQualityGate fails with Timeout has been exceeded though SonarQube shows the analysis as completeLikely causes β SonarQube webhook to Jenkins missing, wrong URL (needs /sonarqube-webhook/), blocked by network, or secret mismatch.
Diagnose β SonarQube Administration > Configuration > Webhooks delivery history (last response code).
Fix β Add the webhook to https://jenkins.example.com/sonarqube-webhook/; align the webhook secret with Jenkins config; open network path.
Prevent β Include the webhook in SonarQube's configuration as code or provisioning scripts.
Q93 Sonar scanner: ERROR: Not authorized. Analyzing this project requires authentication. Please check the user token in the property 'sonar.token' or the environment variable 'SONAR_TOKEN'.
Beginner
ERROR: Not authorized. Analyzing this project requires authentication. Please check the user token in the property 'sonar.token' or the environment variable 'SONAR_TOKEN'.Likely causes β Token missing, expired or revoked; the Sonar server config in Jenkins points to a wrong credential; token lacks "Execute Analysis" permission for the project.
Diagnose β Check the credential ID in the SonarQube server config; test the token with curl -u $TOKEN: https://sonar/api/authentication/validate.
Fix β Generate a new token with the right permissions, update the Jenkins credential.
Prevent β Use a project analysis token or global analysis token owned by a service account, with rotation.
Q94 Maven deploy to Nexus: Failed to deploy artifacts: Could not transfer artifact com.shack:app:jar:1.4.0 from/to maven-releases: status code: 400, reason phrase: Repository does not allow updating assets: maven-releases (400)
Beginner
Failed to deploy artifacts: Could not transfer artifact com.shack:app:jar:1.4.0 from/to maven-releases: status code: 400, reason phrase: Repository does not allow updating assets: maven-releases (400)Likely causes β Re-deploying an existing release version; the releases repository disallows redeploy.
Diagnose β Check Nexus for the existing artifact; check whether the build re-ran for the same tag.
Fix β Bump the version; never overwrite releases. For reruns, skip deploy if the artifact already exists.
Prevent β Version from tags, deploy releases only from tag builds, snapshots for branches.
Q95 Nexus returns status code: 401, reason phrase: Unauthorized (401) during mvn deploy
Beginner
status code: 401, reason phrase: Unauthorized (401) during mvn deployLikely causes β settings.xml <server><id> does not match the <repository><id> in distributionManagement, credentials not injected, or wrong password.
Diagnose β mvn -B help:effective-settings -s ci/settings.xml (passwords masked); compare IDs.
Fix β Align IDs; inject credentials via withCredentials or Config File Provider with credential mapping.
Prevent β Library step that generates settings.xml from credentials consistently.
Q96 docker: Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running? inside a Kubernetes agent pod
Beginner
docker: Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running? inside a Kubernetes agent podLikely causes β No Docker daemon exists in the pod (and nodes run containerd), so docker build cannot work.
Diagnose β ls -l /var/run/docker.sock in the container; node runtime via kubectl get nodes -o wide.
Fix β Use Kaniko or BuildKit for builds in pods; avoid mounting a host socket. If you must use Docker, use a dedicated VM agent with Docker installed.
Prevent β Standard image build step in the library based on a daemonless builder.
Q97 Kaniko: error checking push permissions -- make sure you entered the correct tag name, and that you are authenticated correctly, and try again: checking push permission for "docker.io/devopsshack/shack-app:main-1a2b3c4": POST https://index.docker.io/v2/devopsshack/shack-app/blobs/uploads/: UNAUTHORIZED
Advanced
error checking push permissions -- make sure you entered the correct tag name, and that you are authenticated correctly, and try again: checking push permission for "docker.io/devopsshack/shack-app:main-1a2b3c4": POST https://index.docker.io/v2/devopsshack/shack-app/blobs/uploads/: UNAUTHORIZEDLikely causes β Missing or malformed /kaniko/.docker/config.json, wrong registry key (https://index.docker.io/v1/ for Docker Hub), wrong repo name, or token lacks write scope.
Diagnose β cat /kaniko/.docker/config.json (in a debug run, never print in normal builds); verify the token can push with crane auth login and crane push.
Fix β Generate config.json with the correct auth:
AUTH=$(printf '%s:%s' "$REG_USER" "$REG_PASS" | base64 | tr -d '\n')
printf '{"auths":{"https://index.docker.io/v1/":{"auth":"%s"}}}' "$AUTH" > /kaniko/.docker/config.jsonPrevent β Library step that writes the config and validates the repository name.
Q98 Trivy: FATAL Fatal error init error: DB error: failed to download vulnerability DB ... TOOMANYREQUESTS
Intermediate
FATAL Fatal error init error: DB error: failed to download vulnerability DB ... TOOMANYREQUESTSLikely causes β Many ephemeral pods downloading the DB from the public registry hit rate limits; no network egress.
Diagnose β Error text mentions the DB repository; check egress rules.
Fix β Mirror the DB to an internal registry and use --db-repository registry.example.com/trivy-db (and --java-db-repository), or cache the DB on a PVC with --cache-dir and --skip-db-update on most builds.
Prevent β A scheduled job that refreshes the internal DB mirror.
Q99 Deploy stage: error: You must be logged in to the server (Unauthorized) from kubectl
Beginner
error: You must be logged in to the server (Unauthorized) from kubectlLikely causes β Expired token in the kubeconfig credential, wrong kubeconfig, or (on EKS) the IAM identity is not mapped in access entries/aws-auth.
Diagnose β kubectl config view --minify, kubectl auth whoami (1.28+), aws sts get-caller-identity for EKS.
Fix β Refresh the credential; for EKS add an access entry for the role; prefer in-cluster service accounts for deploy pods.
Prevent β Avoid static kubeconfigs; use service accounts or workload identity.
Q100 kubectl rollout status fails: error: deployment "shack-app" exceeded its progress deadline
Intermediate
kubectl rollout status fails: error: deployment "shack-app" exceeded its progress deadlineLikely causes β New pods never become ready: image pull failure (wrong tag pushed), crash loop, failing readiness probe, insufficient resources.
Diagnose β
kubectl -n shack-dev get pods -l app=shack-app
kubectl -n shack-dev describe pod <new-pod>
kubectl -n shack-dev logs <new-pod> --previousFix β Fix the root cause; roll back with kubectl -n shack-dev rollout undo deploy/shack-app (automate it in post { failure {} }).
Prevent β Smoke test images in CI, realistic probes, and automated rollback in the deploy step.