# IC0406 CanisterReject Error on Update Calls When Using inspect\_message

**URL:** <https://forum.dfinity.org/t/ic0406-canisterreject-error-on-update-calls-when-using-inspect-message/41854>\
**Category:** Rust\
**Created:** [March 4, 2025, 11:48am UTC](https://forum.dfinity.org/t/ic0406-canisterreject-error-on-update-calls-when-using-inspect-message/41854 "2025-03-04T11:48:24Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![jyotirmaygithub](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/jyotirmaygithub/32/23999_2.png) [@jyotirmaygithub](https://forum.dfinity.org/u/jyotirmaygithub)\
**Post date:** [March 4, 2025, 11:48am UTC](https://forum.dfinity.org/t/ic0406-canisterreject-error-on-update-calls-when-using-inspect-message/41854/1 "2025-03-04T11:48:24Z")

</div>

I am facing an issue where every update call to my canister gets rejected with the error:

> The replica returned a rejection error: reject code CanisterReject, reject message Error from Canister avqkn-guaaa-aaaaa-qaaea-cai: Canister rejected the message, error code Some(“IC0406”)

This happens after I added an `inspect_message` function to block certain method calls. Below is my implementation of `inspect_message`:

```auto
#[ic_cdk::inspect_message]
fn inspect_message() {
    let method_name = ic_cdk::api::call::method_name();
    ic_cdk::println!("Inspecting method call: {}", method_name);

    if method_name == "faucet" {
        ic_cdk::println!("Execution blocked! User has reached the limit.");
        ic_cdk::api::call::reject("Limit reached: Cannot click more than 5 times.");
    } else {
        ic_cdk::println!("Execution allowed for {}", method_name);
    }
}

```

However, after deploying this, all update calls fail, even the ones that should be allowed. For example, calling my simple update function and other update functions as well.

```auto
#[update]
pub fn think() {
    ic_cdk::println!("i think ");
}

```

---

<div class="post-metadata">

**Author:** ![maksym](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/maksym/32/15263_2.png) [@maksym](https://forum.dfinity.org/u/maksym)\
**Post date:** [March 4, 2025, 12:48pm UTC](https://forum.dfinity.org/t/ic0406-canisterreject-error-on-update-calls-when-using-inspect-message/41854/2 "2025-03-04T12:48:35Z")

</div>

> [@jyotirmaygithub](#):
>
> `inspect_message`

In the provided example I don’t see any calls of `ic0.accept_message()` meaning every inspect\_message call does not accept any message. Can this be the reason for that error?

> **[The Internet Computer Interface Specification | Internet Computer](https://internetcomputer.org/docs/references/ic-interface-spec#system-api-inspect-message)**
>
> Introduction

In `ic_cdk` it should be `ic_cdk::api::call::accept_message`, see [accept\_message in ic\_cdk::api::call - Rust](https://docs.rs/ic-cdk/0.17.1/ic_cdk/api/call/fn.accept_message.html)

---

<div class="post-metadata">

**Author:** ![jyotirmaygithub](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/jyotirmaygithub/32/23999_2.png) [@jyotirmaygithub](https://forum.dfinity.org/u/jyotirmaygithub)\
**Post date:** [March 4, 2025, 1:14pm UTC](https://forum.dfinity.org/t/ic0406-canisterreject-error-on-update-calls-when-using-inspect-message/41854/3 "2025-03-04T13:14:54Z")

</div>

Yes, you are right i was not able to figure it out the use of the accept message, now things are working fine by the way.
