Hey @cwb2819259, sorry for this bad error message. Are you sure the canister_id field you passed in was for an existing canister? I’d expect this error to show up if you try to use a canister_id that doesn’t exist.
We’ve also merged a change that fixes the error message here, so after the current release the error should indicate that the subnet for the requested canister couldn’t be found.
Ok, then I’m not sure exactly what’s going wrong. Can you send some steps to reproduce this (the sequence of dfx commands and canister source)? Also what does the error look like now when you run try it on mainnet?
Has anyone managed to reproduce/fix this? Here is a minimally reproducible snippet which shows the canister ID should be correct, unless I’m missing something? This code produces the same error described above: Err((DestinationInvalid, "No route to canister aaaaa-aa"))
This could just be the same problem you were seeing in dfx. As mentioned earlier in the thread, the “No route to canister aaaaa-aa” message wasn’t the real error and we’ve rolled out changes to mainnet to show the real error. But it looks like those changes haven’t hit dfx yet.
Which version of the ic_cdk rust library do you have in your Cargo.lock? I just tried to reproduce the error with your first snippet and it succeeded. Here’s exactly what I did:
dfx new create_canister_error --type rust --no-frontend
# copy your first snippet into `src/create_canister_error_backend/src/lib.rs` and add required imports
# Add `"install": () -> ();` to `create_canister_error_backend.did`
dfx start --background
dfx canister call create_canister_error_backend install '()'