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

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:

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

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).


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

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

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.

1 Like

Guessing that Release 0.18.0 · dfinity/sdk · GitHub doesn’t fix this either.

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.


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

1 Like

The fix was made here in the main IC repo: fix(RUN-896): Raise unzipped Wasm limit · dfinity/ic@5705126 · GitHub