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"
1 Like

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.
9 Likes

Looks like that’s exactly what happened, thanks!

Thanks for answering @dralves

You probably can’t acceptCycles in a query, it needs to be an update.

You need to change that method to an update method.

I don’t have enough information to answer that, if you could explain more