Get_candid_interface_tmp_hack gives IC503 error

I’m trying to query canisters for their candid. This is the command I’m using:
dfx canister call {canister-id} __get_candid_interface_tmp_hack --network ic

This canister returns the expected results: 7rd6z-riaaa-aaaak-afesa-cai

but when I run the same command with this canister: kioj7-mqaaa-aaaag-qctla-cai I get the following error:

Caused by: Failed update call.
  The replica returned a replica error: reject code CanisterError, reject message Canister kioj7-mqaaa-aaaag-qctla-cai trapped explicitly: canister_inspect_message implicitly refused message, error code Some("IC0503")

While researching the “IC0503” error, I found that someone recommended restarting my local replica, but I deemed that as not applicable as I am trying to call a canister on the IC.

The dashboard seems to be able to get the candid for the canister kioj7-mqaaa-aaaag-qctla-cai as you can see here: Canister: kioj7-mqaaa-aaaag-qctla-cai - ICP Dashboard

Why am I getting this IC0503 error?

I don’t know what the error source is, but you can get the candid interface like this:

dfx canister metadata kioj7-mqaaa-aaaag-qctla-cai --network ic candid:service
2 Likes

So is this method deprecated? I see that it seems to fail on my newer motoko canisters compiled with dfx 18.

How do we call this from a browser to retrieve a candid file?

agent-js has a utility method for this: @dfinity/agent

Personally in the wallet that I’m developing, I’m checking the metadata with above utility method first and then fallback to the tmp canister method mentioned above if the metadata is empty (older canisters).