What does wrong magic number mean?

Hello Dears!

When I try to install wasm module, a simple code works, but some complex codes shows an error: wrong magic number: [32, 0, 0, 0]

May I wrongly converting wasm to Vec<u8>?
Or how can I deal with that?

This likely means that some code was expecting Candid-encoded data, but received something else (raw binary data).

In your case, is this error coming from your canister? dfx? the JS library?

In my case it comes from dfx that I’m trying to install canister dynamically
Now I think may be I’m building wasm code wrongly
The question is how to create Candid-encoded wasm?

I found this error message related to initial arguments when installing canister code

Ah, it could also complain about the wrong magic number of a wasm module, of course. Sorry for jumping to conclusions.

What is the command line you use to install canister code?

I’m using rust to install canister programmatically