Skip to content
Latchkey

Jenkins "Required context class hudson.Launcher is missing" in CI

A step that needs an executor (such as sh or bat) ran without an allocated node. Those steps require a hudson.Launcher context, which only a node block (or a Declarative agent) provides, so Jenkins aborts asking you to wrap the code.

What this error means

The build fails with Required context class hudson.Launcher is missing. Perhaps you forgot to surround the code with a step that provides this, such as: node. It typically happens with agent none plus a top-level sh, or a sh in post without an agent.

Jenkins console
Required context class hudson.Launcher is missing
Perhaps you forgot to surround the code with a step that provides this, such as: node
	at org.jenkinsci.plugins.workflow.steps.DynamicContext$Typed.get(DynamicContext.java:95)

Common causes

A shell step ran with no node allocated

In Scripted pipelines a sh outside node {}, or in Declarative with agent none and a stage that has no agent, leaves no executor to launch the process.

A post block runs without an agent

A post section that runs sh while the pipeline used agent none has no launcher context unless that block declares an agent.

How to fix it

Wrap the step in a node / agent

  1. Identify the step that needs an executor (sh, bat, checkout).
  2. Surround it with node { ... } (Scripted) or give the stage an agent (Declarative).
  3. For post, set an agent on the stage or pipeline so the block has a launcher.
Jenkinsfile (Scripted)
node('linux') {
  sh 'make test'
}

How to prevent it

  • Use agent none only when each stage that runs shell steps declares its own agent.
  • Keep executor-bound steps inside node/agent blocks, not at pipeline top level.
  • Give post blocks an agent when they invoke sh/bat.

Frequently asked questions

What causes ""Required context class hudson.Launcher is missing""?
In Scripted pipelines a sh outside node {}, or in Declarative with agent none and a stage that has no agent, leaves no executor to launch the process.
How do I fix "Required context class hudson.Launcher is missing"?
Wrap the step in a node / agent

Related guides

References

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