`WorkflowScript: 14: Environment variable values must either be single quoted, double quoted, or function calls.`
BeginnerTroubleshootingJenkinsfile syntax, Groovy & CPS errors
Answer
Likely causes → An unquoted value or expression in environment {}, e.g. TAG = env.BRANCH_NAME + '-x' or COUNT = 3.
Diagnose → Line 14 of the Jenkinsfile.
Fix → Use a GString: TAG = "${env.BRANCH_NAME}-x", or compute in a script {} block with env.TAG = ....
Prevent → Keep environment for static strings and credentials(); compute dynamic values in a dedicated stage.
More on Jenkinsfile syntax, Groovy & CPS errors
`WorkflowScript: 1: Missing required section "agent" @ line 1, column 1.`Beginner`Unknown stage section "step". Starting with version 0.5, steps in a stage must be in a ‘steps’ block.`Beginner`java.lang.NoSuchMethodError: No such DSL method 'withSonarQubeEnv' found among steps [archive, bat, build, ...]`Beginner`java.io.NotSerializableException: java.util.regex.Matcher`Advanced`java.io.NotSerializableException: groovy.json.internal.LazyMap`Intermediate`org.jenkinsci.plugins.scriptsecurity.sandbox.RejectedAccessException: Scripts not permitted to use method groovy.lang.GroovyObject invokeMethod java.lang.String java.lang.Object`Intermediate