Skip to content
Latchkey

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.

jenkins
hudson.AbortException: script returned exit code 2
	at org.jenkinsci.plugins.workflow.steps.durable_task.DurableTaskStep

Common 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

  1. Use the AbortException message to find which step failed and why.
  2. Fix the command, credentials, or input it depends on.

Handle expected failures gracefully

  1. Wrap optional work in catchError or try/catch to continue or set build status intentionally.
Jenkinsfile
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.

Frequently asked questions

What causes ""hudson.AbortException""?
sh, bat, checkout, or build threw AbortException because the underlying command or operation failed.
How do I fix "hudson.AbortException"?
Read the message and fix the underlying step

Related guides

References

Latchkey auto-heals failures like this one - detected, fixed, and retried without you. Start free → 30-day trial · No credit card