Jenkins "hudson.AbortException" Build Step Failed
A pipeline step raised hudson.AbortException, the controlled way Jenkins signals that a step failed and the build should stop.
What this error means
The build ends with hudson.AbortException and a message naming the failing step. Unlike a stack-trace crash, this is a clean, expected failure path with a human-readable reason.
hudson.AbortException: script returned exit code 2
at org.jenkinsci.plugins.workflow.steps.durable_task.DurableTaskStepCommon causes
A wrapped step failed
sh, bat, checkout, or build threw AbortException because the underlying command or operation failed.
An explicit error step
Code called error("...") to deliberately fail the build with a message.
How to fix it
Read the message and fix the underlying step
- Use the AbortException message to find which step failed and why.
- Fix the command, credentials, or input it depends on.
Handle expected failures gracefully
- Wrap optional work in catchError or try/catch to continue or set build status intentionally.
catchError(buildResult: 'UNSTABLE', stageResult: 'FAILURE') {
sh 'make optional-task'
}How to prevent it
- Use error() with clear messages for intentional failures so AbortException output explains exactly what went wrong.