# iRule error

**URL:** <https://community.f5.com/t/irule-error/21214>\
**Category:** Technical Forums\
**Tags:** asm-advanced-waf, irules, security, application-delivery\
**Created:** [January 29, 2019, 2:21pm UTC](https://community.f5.com/t/irule-error/21214 "2019-01-29T14:21:12Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Brandon\_12607](https://avatars.discourse-cdn.com/v4/letter/b/90db22/32.png) [@Brandon\_12607](https://community.f5.com/u/Brandon_12607)\
**Post date:** [January 29, 2019, 2:21pm UTC](https://community.f5.com/t/irule-error/21214/1 "2019-01-29T14:21:12Z")

</div>

When i try to save the IRULE it gives me the following error. Trying to block all non app traffic to vip combined with using a SDK on ASM

Here are the errors

1070151:3: Rule [/Common/ASM\_SDK] error: /Common/ASM\_SDK:3: error: [command is not valid in current event context (HTTP\_REQUEST)][BOTDEFENSE::reason]

/Common/ASM\_SDK:2: error: [command is not valid in current event context (HTTP\_REQUEST)][BOTDEFENSE::action]

Below is the iRule:

when HTTP\_REQUEST { if { ([BOTDEFENSE::action] eq “allow”) && (not ([string tolower [BOTDEFENSE::reason]] starts\_with “valid mobile application cookie”)) } { BOTDEFENSE::action tcp\_rst } }

---

<div class="post-metadata">

**Author:** ![Niels\_van\_Sluis](https://d1p9zq3aats0t8.cloudfront.net/user_avatar/community.f5.com/niels_van_sluis/32/3759_2.png) [@Niels\_van\_Sluis](https://community.f5.com/u/Niels_van_Sluis)\
**Post date:** [January 29, 2019, 2:42pm UTC](https://community.f5.com/t/irule-error/21214/2 "2019-01-29T14:42:26Z")

</div>

It seems the

```tcl
BOTDEFENSE

```

commands are only valid in the

```tcl
BOTDEFENSE_ACTION

```

event. You are using them in the

```tcl
HTTP_REQUEST

```

event. See:

> **[DevCentral](https://community.f5.com/)**
>
> DevCentral is an online technical community where engineers and practitioners collaborate, share knowledge, and solve problems related to F5 technologies and industry trends.

---

<div class="post-metadata">

**Author:** ![Lee\_Sutcliffe](https://avatars.discourse-cdn.com/v4/letter/l/958977/32.png) [@Lee\_Sutcliffe](https://community.f5.com/u/Lee_Sutcliffe)\
**Post date:** [January 29, 2019, 2:43pm UTC](https://community.f5.com/t/irule-error/21214/3 "2019-01-29T14:43:33Z")

</div>

BOTDEFENSE:: namespace commands are not valid within an

```tcl
HTTP_REQUEST

```

event.

Take a look at the Wiki -

```tcl
BOTDEFENSE_ACTION

```

is the only valid event for

```tcl
BOTDEFENSE::action

```

and

```tcl
BOTDEFENSE::reason

```

[DevCentral](https://devcentral.f5.com/wiki/iRules.BOTDEFENSE__action.ashx) [DevCentral](https://devcentral.f5.com/wiki/iRules.BOTDEFENSE__reason.ashx)
