# How to force activity to retry?

**URL:** <https://community.temporal.io/t/how-to-force-activity-to-retry/2776>\
**Category:** Community Support\
**Tags:** general-impl\
**Created:** [August 24, 2021, 2:41pm UTC](https://community.temporal.io/t/how-to-force-activity-to-retry/2776 "2021-08-24T14:41:52Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![andrew.sch](https://avatars.discourse-cdn.com/v4/letter/a/d9b06d/32.png) [@andrew.sch](https://community.temporal.io/u/andrew.sch)\
**Post date:** [August 24, 2021, 2:41pm UTC](https://community.temporal.io/t/how-to-force-activity-to-retry/2776/1 "2021-08-24T14:41:52Z")

</div>

Hi,

I have an activity that makes an api request. Under some cases the api may return some error codes such as a 429 if I am sending too many requests. I want the activity to wait and retry when I get this error code. From the docs I see that I would have to force a timeout to get it to retry. I would prefer to not add a Thread.sleep when I get the error. Is there another way to mark a run as failed?

---

<div class="post-metadata">

**Author:** ![maxim](https://sea2.discourse-cdn.com/flex016/user_avatar/community.temporal.io/maxim/32/8_2.png) [@maxim](https://community.temporal.io/u/maxim)\
**Post date:** [August 24, 2021, 3:44pm UTC](https://community.temporal.io/t/how-to-force-activity-to-retry/2776/2 "2021-08-24T15:44:02Z")

</div>

By default an activity has an associated RetryOptions. So it is retired on any failure which is not marked as non retryable.

So in your case just fail an activity (by throwing an exception in Java/PHP/Typescript or returning error in Go) to get it retried.
