# How to handle Error: getaddrinfo ENOTFOUND

**URL:** <https://community.postman.com/t/how-to-handle-error-getaddrinfo-enotfound/22050>\
**Category:** Help Hub\
**Created:** [March 29, 2021, 7:55pm UTC](https://community.postman.com/t/how-to-handle-error-getaddrinfo-enotfound/22050 "2021-03-29T19:55:01Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![MmmmMmmm](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/mmmmmmmm/32/4978_2.png) [@MmmmMmmm](https://community.postman.com/u/MmmmMmmm)\
**Post date:** [March 29, 2021, 7:55pm UTC](https://community.postman.com/t/how-to-handle-error-getaddrinfo-enotfound/22050/1 "2021-03-29T19:55:01Z")

</div>

Is there a way to handle ENOTFOUND in a way that doesn’t break the script?  
I have a service that I’m calling which may or may not be present, so I want to script around the availability of this endpoint. Unfortunately the script dies when it tries to call the unavailable service. I really want it to simply error in a way that I can detect and handle in the script.

---

<div class="post-metadata">

**Author:** ![taehoshino](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/taehoshino/32/6608_2.png) [@taehoshino](https://community.postman.com/u/taehoshino)\
**Post date:** [March 30, 2021, 12:49am UTC](https://community.postman.com/t/how-to-handle-error-getaddrinfo-enotfound/22050/2 "2021-03-30T00:49:13Z")

</div>

Hey @MmmmMmmm 👋

As I understand it, you want to validate a request URL availability before sending your request, is that correct?

In that case, I suppose you can include something like following script in your pre-request script and modify URL value stored in environment variable:

 ![Screen Shot 2021-03-30 at 11.48.46 am](https://us1.discourse-cdn.com/getpostman/original/3X/2/8/28bec99065721f6ad610b97d3e89bc0d565a9176.png)

Hope this helps! 😃

---

<div class="post-metadata">

**Author:** ![MmmmMmmm](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/mmmmmmmm/32/4978_2.png) [@MmmmMmmm](https://community.postman.com/u/MmmmMmmm)\
**Post date:** [April 2, 2021, 9:28pm UTC](https://community.postman.com/t/how-to-handle-error-getaddrinfo-enotfound/22050/3 "2021-04-02T21:28:56Z")

</div>

Huge thanks Taehoshino !! Really saves me from a nasty workaround.
