Canister violated contract: "ic0_msg_caller_size" cannot be executed in reply callback mode

Does anyone know what this error means?

The Replica returned an error: code 5, message: "Canister rrkah-fqaaa-aaaaa-aaaaq-cai violated contract: "ic0_msg_caller_size" cannot be executed in reply callback mode"

It seems like it’s because I called ic_cdk::caller() twice in my canister function…any insights?

Not sure. Let me ping some folks.

1 Like

@lastmjs “ic0_msg_caller_size” returns the size of the caller, but it can’t be executed in reply callbacks since there is no caller, the other canister is just replying to our message.

That is, I suspect that you’re doing the following:

  • call another canister
  • call “caller()” when the reply to the call above is received

You want to do the following:

  • store caller()
  • call another canister
  • handle the reply/reference caller that you stored above.
2 Likes

Looks like that’s exactly what happened, thanks!

Thanks for answering @dralves