# Error while trying to capture Jenkins error message - getRawBuild method restriction

**URL:** <https://community.jenkins.io/t/error-while-trying-to-capture-jenkins-error-message-getrawbuild-method-restriction/19163>\
**Category:** Ask a question\
**Tags:** question, pipeline\
**Created:** [September 5, 2024, 7:19pm UTC](https://community.jenkins.io/t/error-while-trying-to-capture-jenkins-error-message-getrawbuild-method-restriction/19163 "2024-09-05T19:19:40Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![LCG98](https://avatars.discourse-cdn.com/v4/letter/l/dec6dc/32.png) [@LCG98](https://community.jenkins.io/u/LCG98)\
**Post date:** [September 5, 2024, 7:19pm UTC](https://community.jenkins.io/t/error-while-trying-to-capture-jenkins-error-message-getrawbuild-method-restriction/19163/1 "2024-09-05T19:19:40Z")

</div>

Hi,

I am trying to capture the last error line from Jenkins console output that starts with the word `ERROR`. My goal is to identify the exact error message in the pipeline console log. However, I ran into an issue when attempting to implement the following code:

```auto
[Pipeline] // withCredentials
[Pipeline] }
[Pipeline] // withEnv
[Pipeline] }
[Pipeline] // node
[Pipeline] End of Pipeline
ERROR: Error during the Checkout and Build Modules stage: Unable to create live FilePath for docker-slave; docker-slave was marked offline: Node is being removed
Finished: FAILURE

```

I tried to use the `getRawBuild()` method to extract the error, but I received the following error message:

```auto
Scripts not permitted to use method org.jenkinsci.plugins.workflow.support.steps.build.RunWrapper getRawBuild. Administrators can decide whether to approve or reject this signature.

```

Could someone guide me on how to properly capture the error line in the Jenkins console output without running into script approval issues? Is there a more Jenkins-safe way to extract this information?
