# Canister \[Canister ID\] trapped: unknown

**URL:** <https://forum.dfinity.org/t/canister-canister-id-trapped-unknown/24047>\
**Category:** Developers\
**Created:** [October 27, 2023, 6:15pm UTC](https://forum.dfinity.org/t/canister-canister-id-trapped-unknown/24047 "2023-10-27T18:15:20Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![princess\_eth](https://avatars.discourse-cdn.com/v4/letter/p/ce7236/32.png) [@princess\_eth](https://forum.dfinity.org/u/princess_eth)\
**Post date:** [October 27, 2023, 6:15pm UTC](https://forum.dfinity.org/t/canister-canister-id-trapped-unknown/24047/1 "2023-10-27T18:15:20Z")

</div>

Hello, I am getting this error: `Canister [Canister ID] trapped: unknown`. Does anyone know what this means?

I am calling a backend function in a backend canister in a React frontend.

I confirmed that the frontend is able to access the declaration by console logging the candid declaration.

```auto
The full error:
Error fetching proposals: Error: Call failed:
  Canister: [Canister ID]
  Method: [query name]
  "Status": "rejected"
  "Code": "CanisterError"
  "Message": "IC0502: Canister [Canister ID] trapped: unknown"

```

---

<div class="post-metadata">

**Author:** ![princess\_eth](https://avatars.discourse-cdn.com/v4/letter/p/ce7236/32.png) [@princess\_eth](https://forum.dfinity.org/u/princess_eth)\
**Post date:** [October 27, 2023, 10:26pm UTC](https://forum.dfinity.org/t/canister-canister-id-trapped-unknown/24047/2 "2023-10-27T22:26:50Z")

</div>

I was able to resolve this error by resolving an error in my backend canister (using Azle) that was not detected by the compiler.

I am not sure which error it was specifically but:

- [Probably what caused this error] I recently updated a type within an interface. I did not update the type passed into an update function that used that interface. For example:

```auto
const Data = Record({
    id: text,
   amount: int8
})

createData: update([text, nat32], Data, async (id, amount) => {
})

```

- [This probably had no impact] I was passing empty function into another function. I updated the function to return a statement.

FYI @lastmjs

---

<div class="post-metadata">

**Author:** ![lastmjs](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/lastmjs/32/3406_2.png) [@lastmjs](https://forum.dfinity.org/u/lastmjs)\
**Post date:** [November 1, 2023, 12:54pm UTC](https://forum.dfinity.org/t/canister-canister-id-trapped-unknown/24047/3 "2023-11-01T12:54:00Z")

</div>

Would you be able to provide more details? I don’t quite understand what the issue was, and I’m trying to understand if this is a problem with Azle itself.

---

<div class="post-metadata">

**Author:** ![princess\_eth](https://avatars.discourse-cdn.com/v4/letter/p/ce7236/32.png) [@princess\_eth](https://forum.dfinity.org/u/princess_eth)\
**Post date:** [November 4, 2023, 4:18pm UTC](https://forum.dfinity.org/t/canister-canister-id-trapped-unknown/24047/4 "2023-11-04T16:18:06Z")

</div>

It seems that Azle can still compile even with a type mismatch.

For example, here is type `Data`:

```auto
const Data = Record({
    id: text,
   amount: int8
})

```

In this function, I am passing in type Data - the function accepts a nat32 for amount but amount is actually an int8:

```auto
createData: update([text, nat32], Data, async (id, amount) => {
   return data.insert(id, amount);
})

```

When I run `npx azle [canisterName]`, I do not receive any errors. However, when I test the function in the Candid UI, I will receive a type error.

Does that help?
