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

**Code:** `WorkflowScript compilation error` · **Category:** CI/CD · **Seen on:** Jenkins

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

## 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?

---
Source: [WhatIsMyError](https://whatismyerror.com/errors/cicd/jenkins-groovy-compilation-error)
