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.
WorkflowScript: unexpected tokenorg.codehaus.groovy.control.MultipleCompilationErrorsException: startup failedWorkflowScript: expecting '}'Expected a step @ lineWorkflowScript: 1 error 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
- Go to the line and column in the message
- Validate with the linter:
curl -X POST -F "jenkinsfile=<Jenkinsfile" $JENKINS/pipeline-model-converter/validate - Use
script { }for scripted logic inside Declarative
Detailed fix by platform
Jenkins
- In
shblocks use triple single quotes'''…'''to avoid Groovy interpolating$
Code examples
Script block inside Declarative
pipeline {
agent any
stages {
stage('Test') {
steps {
script { def v = readFile('VERSION').trim(); echo "v=${v}" }
}
}
}
}How to diagnose
- Position — Line and column given?
- Braces — Balanced?
- 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:
Similar errors
- ComparisonError: manifest generation failed Argo CD: ComparisonError: rpc error: code = Unknown desc = Manifest generation error (cached): kustomize build failed
- Could not find credentials entry Jenkins: ERROR: Could not find credentials entry with ID 'github-token'
- Invalid workflow file GitHub Actions: Invalid workflow file: .github/workflows/ci.yml#L12 — You have an error in your yaml syntax on line 12
Most viewed in CI/CD
- Unable to download artifact GitHub Actions: Error: Unable to download artifact(s): Artifact not found for name: build
- .gitlab-ci.yml invalid GitLab CI: Found errors in your .gitlab-ci.yml: jobs:build config contains unknown keys: scripts
- couldn't find remote ref (checkout) GitHub Actions: fatal: couldn't find remote ref refs/heads/feature — The process '/usr/bin/git' failed with exit code 1 (actions/checkout)
Other ways to find it
Where this error sits
Origin: Build & delivery. Errors that are often confused with or caused by this one (click to open):
🧠 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.
Report a correction or suggest an improvement
Last updated 25 Oct 2026