title: groovy.lang.MissingPropertyException: No such property: ERROR_MESSAGE for class: groovy.lang.Binding
body: <p>I know this issue has been asked quite a number of times but the reasons are always different for occurrence of this hence asking again.</p>
  <p>I recently upgraded my jenkins from 2.270 to 2.278 version.</p>
  <p>After the upgrade when I tried running one of the pipelines I got the following error and the pipeline failed.</p>
  <p><strong><strong>groovy.lang.MissingPropertyException: No such property: ERROR_MESSAGE for class: groovy.lang.Binding</strong></strong></p>
  <p>The code snipplet where it points to look like this.</p>
  <pre><code>   def &lt;func2&gt;(body) {
  
        &lt;some code&gt;
        stages {
            stage('Initialise') {
              steps {
                  buildName &quot;${JOB_NAME}#${BUILD_NUMBER}&quot;
                  script{
                      if (env.RELEASE == &quot;1.0&quot;){
                          env.ERROR_MESSAGE = &quot;Please provide RELEASE&quot;
                          currentBuild.result = 'FAILURE'
                          return
                      }
                  }
              }
             post {
                      unsuccessful {
                          notifySlack(
                              **message: &quot;Deploy Initialise failed: ${ERROR_MESSAGE}&quot;,**
                              channel:&quot;${slackDeployChannel}&quot;)
                              script{
                                  env.DEPLOY = 'no'
                              }
                      }
              }
          }
  </code></pre>
  <p>and one more place the env.ERROR_MESSAGE is being called</p>
  <pre><code>def &lt;func1&gt;(arguments) {
    try{
         &lt;SOME CODE&gt;
         return 0
       }
       catch (Exception e) {
         env.ERROR_MESSAGE = e.getMessage()
         return 0
       }
      }
  </code></pre>
  <p>both func1 and func2 are separate functions being called separately.
  Not sure if env.ERROR_MESSAGE is being initialised or not.</p>
  <p>Any leads would be appreciated.</p>
  <p>Cheers</p>