# Crash During buildmesh Execution: Failure of try-catch and Impact of Additional Boundary

**URL:** <https://community.freefem.org/t/crash-during-buildmesh-execution-failure-of-try-catch-and-impact-of-additional-boundary/3491>\
**Category:** General Discussion\
**Created:** [September 17, 2024, 7:41pm UTC](https://community.freefem.org/t/crash-during-buildmesh-execution-failure-of-try-catch-and-impact-of-additional-boundary/3491 "2024-09-17T19:41:35Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![MariamiMamgo](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.freefem.org/mariamimamgo/32/2641_2.png) [@MariamiMamgo](https://community.freefem.org/u/MariamiMamgo)\
**Post date:** [September 17, 2024, 7:41pm UTC](https://community.freefem.org/t/crash-during-buildmesh-execution-failure-of-try-catch-and-impact-of-additional-boundary/3491/1 "2024-09-17T19:41:35Z")

</div>

Hello,  
I am experiencing an issue with my code, which I have attached for reference. The code consistently crashes during the execution of the `buildmesh` command. I tried to use the try-catch block, but it couldn’t catch the error either. Interestingly, when I add a new tiny boundary `bound00`, the issue disappears for the given parameters.  
My questions are the following:

1. What could be causing this crash during the meshing process and how can I prevent it (without try-catch)?
2. Why does the try-catch block fail to catch and handle this error?
3. How did adding the `bound00` help? Will it help with other parameters’ values?  
I would greatly appreciate your insights on this matter.  
[meshing\_bug\_example(1).edp](https://community.freefem.org/uploads/short-url/7lPNtQ7B9AvMDUY5DDJXfhosikg.edp) (2.0 KB)

---

<div class="post-metadata">

**Author:** ![fb77](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.freefem.org/fb77/32/3796_2.png) [@fb77](https://community.freefem.org/u/fb77)\
**Post date:** [September 18, 2024, 3:37pm UTC](https://community.freefem.org/t/crash-during-buildmesh-execution-failure-of-try-catch-and-impact-of-additional-boundary/3491/2 "2024-09-18T15:37:18Z")

</div>

Hello,  
I think that your borders are too close to each other. When discretized, their boundary elements could cross and make the geometry impossible. It can happen for` bound3` and `bound`4 which are close and for which you ask for a different number of points `meshsize1` or `meshsize2`  
`bound3(meshsize1) + bound4(meshsize2)`  
The fact that they cross or not is somehow random, depending on where the points are located. This randomness could be stimulated by the addition of `bound00`.

---

<div class="post-metadata">

**Author:** ![MariamiMamgo](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.freefem.org/mariamimamgo/32/2641_2.png) [@MariamiMamgo](https://community.freefem.org/u/MariamiMamgo)\
**Post date:** [September 20, 2024, 3:16pm UTC](https://community.freefem.org/t/crash-during-buildmesh-execution-failure-of-try-catch-and-impact-of-additional-boundary/3491/3 "2024-09-20T15:16:03Z")

</div>

Thank you for your reply. Yes, we also suspected that there might be a problem with the distance between boundaries, so we tried using the “try-catch” block to catch the “random” cases and edit the geometry.  
Can you/someone help understand why the “try-catch” block doesn’t work to catch the wrong geometry?
