# Wasm module is too large, it can be at most 31457280 bytes

**URL:** <https://forum.dfinity.org/t/wasm-module-is-too-large-it-can-be-at-most-31457280-bytes/27722>\
**Category:** Developers\
**Created:** [February 20, 2024, 6:50pm UTC](https://forum.dfinity.org/t/wasm-module-is-too-large-it-can-be-at-most-31457280-bytes/27722 "2024-02-20T18:50:51Z")\
**Posts on this page:** 9\
**Page:** 1

<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:** [February 20, 2024, 6:50pm UTC](https://forum.dfinity.org/t/wasm-module-is-too-large-it-can-be-at-most-31457280-bytes/27722/1 "2024-02-20T18:50:51Z")

</div>

Hey so I thought that Wasm modules could be up to 100 MiB with 90 MiB of data section? Is that wrong?

I’m trying to deploy a Wasm module that is 49 MiB using dfx 0.16.1 locally, should be mostly data section, and I get this error:

```auto
Installing canisters...
Upgrading code for canister backend, with canister ID bkyz2-fmaaa-aaaaa-qaaaq-cai
Error: Failed while trying to deploy canisters.
Caused by: Failed while trying to deploy canisters.
  Failed while trying to install all canisters.
    Failed to install wasm module to canister 'backend'.
      Failed during wasm installation call: The replica returned a replica error: reject code CanisterError, reject message Wasm module of canister bkyz2-fmaaa-aaaaa-qaaaq-cai is not valid: Failed to decode wasm module: Wasm module is too large, it can be at most 31457280 bytes, error code None

```

---

<div class="post-metadata">

**Author:** ![abk](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/abk/32/5122_2.png) [@abk](https://forum.dfinity.org/u/abk)\
**Post date:** [February 21, 2024, 9:19am UTC](https://forum.dfinity.org/t/wasm-module-is-too-large-it-can-be-at-most-31457280-bytes/27722/2 "2024-02-21T09:19:53Z")

</div>

Were you also using the option to gzip the Wasm module? If that’s the case then it’s a bug that was fixed in dfx 0.17.0. If that’s not the case then I’ll need some more information to debug what’s happening here (link to the repo, steps to reproduce).

---

<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:** [February 21, 2024, 11:34am UTC](https://forum.dfinity.org/t/wasm-module-is-too-large-it-can-be-at-most-31457280-bytes/27722/3 "2024-02-21T11:34:46Z")

</div>

Yes gzip was set to true in dfx.json. I will try again with dfx 0.17.0, but I wonder if this other issue will still be present: [Can't deploy large Wasm binary, 429 Too Many Requests](https://forum.dfinity.org/t/cant-deploy-large-wasm-binary-429-too-many-requests/27721)

---

<div class="post-metadata">

**Author:** ![Vivienne](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/vivienne/32/29170_2.png) [@Vivienne](https://forum.dfinity.org/u/Vivienne)\
**Post date:** [February 21, 2024, 11:43am UTC](https://forum.dfinity.org/t/wasm-module-is-too-large-it-can-be-at-most-31457280-bytes/27722/4 "2024-02-21T11:43:43Z")

</div>

The other issue will still be around. That will need a new dfx version with a new ic-agent inside

---

<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:** [March 7, 2024, 10:21pm UTC](https://forum.dfinity.org/t/wasm-module-is-too-large-it-can-be-at-most-31457280-bytes/27722/5 "2024-03-07T22:21:32Z")

</div>

I am on dfx 0.17.0 and this issue still persists, it doesn’t matter if gzip is set to true or false. The Wasm binary is 47.3 MB in size, and has a 17.8 MB file, a 12.2 MB file, and a 5.3 MB file included in the binary using the `include_dir` Rust directive. This is an Azle canister. I would expect to have up to 90 MB of data section available.

---

<div class="post-metadata">

**Author:** ![ZackDS](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/zackds/32/40368_2.png) [@ZackDS](https://forum.dfinity.org/u/ZackDS)\
**Post date:** [March 8, 2024, 9:05am UTC](https://forum.dfinity.org/t/wasm-module-is-too-large-it-can-be-at-most-31457280-bytes/27722/6 "2024-03-08T09:05:29Z")

</div>

Guessing that [Release 0.18.0 · dfinity/sdk · GitHub](https://github.com/dfinity/sdk/releases/tag/0.18.0) doesn’t fix this either.

---

<div class="post-metadata">

**Author:** ![abk](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/abk/32/5122_2.png) [@abk](https://forum.dfinity.org/u/abk)\
**Post date:** [March 8, 2024, 7:57pm UTC](https://forum.dfinity.org/t/wasm-module-is-too-large-it-can-be-at-most-31457280-bytes/27722/7 "2024-03-08T19:57:25Z")

</div>

Looks like the fix didn’t actually make it into dfx 0.17.0, but is in 0.18.0. When I make a large canister using `include_bytes` and deploy to a dfx local subnet I do still get your initial error. But it works on dfx 0.18.0.

---

<div class="post-metadata">

**Author:** ![ZackDS](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/zackds/32/40368_2.png) [@ZackDS](https://forum.dfinity.org/u/ZackDS)\
**Post date:** [March 8, 2024, 10:10pm UTC](https://forum.dfinity.org/t/wasm-module-is-too-large-it-can-be-at-most-31457280-bytes/27722/8 "2024-03-08T22:10:46Z")

</div>

Could you point out the fix for this, since I could not find it in the changes. Thank you so very much.

---

<div class="post-metadata">

**Author:** ![abk](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/abk/32/5122_2.png) [@abk](https://forum.dfinity.org/u/abk)\
**Post date:** [March 25, 2024, 8:37am UTC](https://forum.dfinity.org/t/wasm-module-is-too-large-it-can-be-at-most-31457280-bytes/27722/9 "2024-03-25T08:37:30Z")

</div>

The fix was made here in the main IC repo: [fix(RUN-896): Raise unzipped Wasm limit · dfinity/ic@5705126 · GitHub](https://github.com/dfinity/ic/commit/570512674e1f8c3116f562b2297332e0a1e5941f)
