Candid assist feature failing in dfx?

One of my favorite new dfx features is the candid assist functionality that helps developers fill out arguments when calling an endpoint via `dfx canister --ic call <canister_name> <endpoint_name>.

Just recently I noticed this feature starting to fail with the following error:

WARN: Cannot fetch Candid interface for <endpoint_name>, sending arguments with inferred types.

This was working earlier this week, so not sure what might have changed :thinking:

I’m not aware of any recent changes. Maybe the did file from canister metadata doesn’t include that endpoint?

I deployed the canister using Motoko, so it should show up automatically, right? I’m pretty sure that Motoko doesn’t have a good way to hide specific endpoints (although that would be a nice feature to have :sweat_smile:)

This is with dfx 0.21.0 btw. I did however just install dfxvm 0.24.0 on another project to play around a bit before I started having this issue :thinking:

Yes, should be automatic unless you customize the metadata in dfx.json. You can double check the did file by calling dfx canister metadata <canister_id> candid:service

1 Like

Looks like it’s absent? Weird…I haven’t deployed anything recently. Feels like this could be a breaking issue with installing dfx 0.24.0 with dfxvm elsewhere (different repo) and then reverting back to 0.21.0 (the dfx version currently in this project’s dfx.json).

Error: Failed to read `canidid:service` metadata of canister <my_canister>.
Caused by: The lookup path ([63616E6973746572, 00000000016061D50101, 6D65746164617461, 63616E696469643A73657276696365]) is absent in the certificate.

For clarity, I installed dfx 0.24.0 to play around in project B (different project), then I noticed candid assist stopped working there, and when I came back to project A fetching metadata no longer seems to be working.

Project A is using dfx 0.21.0

% dfx --version
dfx 0.21.0

As an aside, is there a list of all the currently available metadata commands? They don’t show up with dfx canister metadata --help

I found the issue, was calling the endpoint name incorrectly (was missing an s on the end of the endpoint name) :man_facepalming: Now it’s working.

Still strange that the candid:service metadata isn’t showing up though.

candid:service is just the custom section name in the Wasm module, so it won’t show up in --help. One way you can try is to use ic-wasm a.wasm metadata or ic-wasm a.wasm info to list the custom sections.

For the missing metadata, maybe it’s in a different network, e.g., local vs mainnet?

1 Like

mainnet shows this

Custom sections with size: [
    "icp:public candid:service (4433 bytes)",
    "icp:private motoko:stable-types (1270 bytes)",
    "icp:private motoko:compiler (6 bytes)",
    "icp:public candid:args (2 bytes)",
    "icp:public dfx (68 bytes)",
]

Ah, it was another spelling error on my end :man_facepalming: …an extra i got in there somehow

Thanks for your help - I learned something about ic-wasm today!