# Cannot Create Thread

**URL:** <https://forum.universal-robots.com/t/cannot-create-thread/22283>\
**Category:** Technical Questions\
**Created:** [June 28, 2022, 7:46am UTC](https://forum.universal-robots.com/t/cannot-create-thread/22283 "2022-06-28T07:46:51Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![m.hammerton](https://avatars.discourse-cdn.com/v4/letter/m/b2d939/32.png) [@m.hammerton](https://forum.universal-robots.com/u/m.hammerton)\
**Post date:** [June 28, 2022, 7:46am UTC](https://forum.universal-robots.com/t/cannot-create-thread/22283/1 "2022-06-28T07:46:51Z")

</div>

I’m trying to write a new Program for pick & place. When I add a Thread and try to run the code I get an error popup

 ![Thread alarm](https://us1.discourse-cdn.com/flex020/uploads/universal_robots/original/2X/c/c6780d72da8a0ebaffba4e4333ff873a1458d96b.png)  
I’m only trying to use 1 thread so can’t understand how the message thinks I’m using 50!  
If I remove the Thread the program runs Ok.

---

<div class="post-metadata">

**Author:** ![MikeM](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.universal-robots.com/mikem/32/3114_2.png) [@MikeM](https://forum.universal-robots.com/u/MikeM)\
**Post date:** [June 28, 2022, 12:27pm UTC](https://forum.universal-robots.com/t/cannot-create-thread/22283/2 "2022-06-28T12:27:48Z")

</div>

If you don’t mind sharing, what does the program look like. Are you running a _check continuously_ if-statement? Do you have some URscript you are executing?

---

<div class="post-metadata">

**Author:** ![m.hammerton](https://avatars.discourse-cdn.com/v4/letter/m/b2d939/32.png) [@m.hammerton](https://forum.universal-robots.com/u/m.hammerton)\
**Post date:** [June 29, 2022, 8:27am UTC](https://forum.universal-robots.com/t/cannot-create-thread/22283/3 "2022-06-29T08:27:39Z")

</div>

Thanks for the response.  
I’ve found the problem myself.

I had a Script file (Get\_Task() used to decide what action to do next) that was returning a value. There was a syntax error on the return command (which Polyscope didn’t notice (and neither did I !!!).

The alarm message I think is misleading although it did identify that it was Get\_task() that was causing the problem.  
but why that would suggest a problem with the thread is confusing.

---

<div class="post-metadata">

**Author:** ![sam.verity-hilton](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.universal-robots.com/sam.verity-hilton/32/6046_2.png) [@sam.verity-hilton](https://forum.universal-robots.com/u/sam.verity-hilton)\
**Post date:** [June 29, 2022, 9:48am UTC](https://forum.universal-robots.com/t/cannot-create-thread/22283/4 "2022-06-29T09:48:06Z")

</div>

If you have any URCaps installed on your robot, some of them might contribute threads to Polyscope. Confusingly, no more than 50 threads can even be declared in a program, even if only 50 intend to run at once. We have had this problem with our URCaps in the past, where we try and contribute more than 50 threads to a program, despite only ever needing to run 1 at once.

Why the syntax error lead to this popup I have no idea!
