Skip to content
Latchkey

Jenkins "WorkflowScript: Missing required section" Declarative validation error

The Declarative pipeline model validates your Jenkinsfile before any stage runs. It found a required block (commonly agent or stages) missing, or a required parameter on a step left out, and aborts at parse time with a WorkflowScript error pointing at a line.

What this error means

The build fails immediately with org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed and a WorkflowScript: N: Missing required section (or Missing required parameter) message. No stage executes.

Jenkins console
WorkflowScript: 2: Missing required section "agent" @ line 2, column 1.
   pipeline {
   ^

WorkflowScript: 4: Missing required parameter: "name" @ line 4, column 13.
       stage {
             ^

2 errors

Common causes

A mandatory Declarative block is absent

A pipeline {} block must contain agent and stages; each stage must have a name argument. Omitting one fails the model validator before execution.

A step is missing a required parameter

A step (for example stage(...), git(...)) was written without the argument the validator marks required, so the compile step rejects it.

How to fix it

Add the section the validator names

  1. Read the line and the named section/parameter in the error.
  2. Add the missing agent, stages, or name argument so the model is complete.
  3. Re-run; the validator passes once every required block is present.
Jenkinsfile
pipeline {
  agent any
  stages {
    stage('Build') {
      steps { sh 'make' }
    }
  }
}

How to prevent it

  • Lint Jenkinsfiles with the "Declarative Linter" (declarative-linter CLI or the /pipeline-model-converter/validate endpoint) before pushing.
  • Keep a known-good minimal pipeline as a template for new jobs.
  • Prefer the Declarative editor or schema-aware tooling to catch missing blocks early.

Related guides

Tired of flaky CI? Latchkey auto-heals failed jobs and retries them for you. Start free →