WorkflowScript compilation error CI/CD Origin: Build & delivery Last updated 25 Oct 2026

Jenkins: WorkflowScript: 12: unexpected token: } @ line 12, column 5. 1 error

The Jenkinsfile has a Groovy/Declarative syntax error, so the build fails before running any stage.

Exact message you may see WorkflowScript: unexpected tokenorg.codehaus.groovy.control.MultipleCompilationErrorsException: startup failedWorkflowScript: expecting '}'Expected a step @ lineWorkflowScript: 1 error
Seen on: Jenkins

Meaning

The line and column in the message are reliable. Typical issues: unbalanced braces, a missing quote, Declarative sections in the wrong order (agent, stages, post), or a step outside steps. Validate with the Declarative linter before committing.

Common causes

  • Unbalanced braces or parentheses
  • Unterminated string or bad escape (\ in Windows paths)
  • Declarative directives in wrong place/order
  • Mixing Scripted and Declarative syntax
  • Invalid string interpolation ($ in single vs double quotes)

⚡ Quick fix

  1. Go to the line and column in the message
  2. Validate with the linter: curl -X POST -F "jenkinsfile=<Jenkinsfile" $JENKINS/pipeline-model-converter/validate
  3. Use script { } for scripted logic inside Declarative

Detailed fix by platform

Jenkins

  1. In sh blocks use triple single quotes '''…''' to avoid Groovy interpolating $

Code examples

Script block inside Declarative

groovy
pipeline {
  agent any
  stages {
    stage('Test') {
      steps {
        script { def v = readFile('VERSION').trim(); echo "v=${v}" }
      }
    }
  }
}

How to diagnose

  1. Position — Line and column given?
  2. Braces — Balanced?
  3. Syntax — Declarative or scripted?

🔧 Still not fixed?

Many errors look alike. If the steps above didn’t solve it, one of these is probably what you’re facing:

Where this error sits

Origin: Build & delivery. Errors that are often confused with or caused by this one (click to open):

ComparisonError: manifest generation failed — Argo CD: ComparisonError: rpc error: code = Unknown desc = Manifest generation error (cached): kustomize build failed (CI/CD)ComparisonError: mani…Could not find credentials entry — Jenkins: ERROR: Could not find credentials entry with ID 'github-token' (CI/CD)Could not find creden…Invalid workflow file — GitHub Actions: Invalid workflow file: .github/workflows/ci.yml#L12 — You have an error in your yaml syntax on line 12 (CI/CD)Invalid workflow fileNo such DSL method — Jenkins: java.lang.NoSuchMethodError: No such DSL method 'dockerBuild' found among steps (CI/CD)No such DSL methodpermission denied /var/run/docker.sock — Jenkins: Got permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock (CI/CD)permission denied /va…Scripts not permitted to use method — Jenkins: org.jenkinsci.plugins.scriptsecurity.sandbox.RejectedAccessException: Scripts not permitted to use method java.lang.String toUpperCase (CI/CD)Scripts not permitted…Waiting for next available executor — Jenkins: Still waiting to schedule task — Waiting for next available executor / 'agent1' is offline (CI/CD)Waiting for next avai…WorkflowS…

Explore the map of this error Full error map →

🧠 Still stuck? Analyze your error

Paste the full message, response headers or stack trace — we'll detect the platform and point to the most likely cause.

💬 What worked for others

No tips yet — did something else fix this for you?

Share what worked for you

Tips are checked by an editor before they appear. Links are removed.