Canister violated contract: Payload Size

The replica returned a rejection error: reject code CanisterReject, reject message IC0504: Error from Canister ozk6r-tyaaa-aaaab-qab4a-cai: Canister violated contract: ic0.msg_reply_data_append: application payload size (4750556) cannot be larger than 2097152., error code None

Iā€™m not sure if the last replica was executed or if itā€™s related. Iā€™m notably unsure because the error message mentions a 2GB limit, but this seems oddly related to the wasm_memory_limit proposal. I might be totally wrong, but I thought Iā€™d share in case it is related.

Correct answer :point_right: Canister violated contract: Payload Size - #3 by ulan

The error message complains about too large message payload. Its payload exceeded the 2MB (not 2GB) limit. Looks like the canister tries to return ~4.5MB in that call (since the error is in msg_reply_data_append).

Can you think of cases when the canister can return large responses?

Regarding, the Wasm memory limit. I donā€™t see the connection. Was the Wasm memory limit proposal recently executed for that canister? If it hits the limit, the error message would be different. If you share the source code, I can take a look to see if there is any connection there.

On one hand, its was early Sunday morning, on the other, the error message was/is misleading, particularly ā€˜application payload sizeā€™. I interpreted ā€˜applicationā€™ as the entire program size. If the message had just contained ā€˜payload size,ā€™ it would have been clear that it referred to the payload. Not sure what ā€˜applicationā€™ means.

1 Like

Haha, I know what you mean with the morning state. Good point about ā€œapplicationā€. I donā€™t know why it says so. Iā€™ll upload a quick fix for that message on Monday.

1 Like

The error message PR: chore: Improve the error message for large payloads by ulan Ā· Pull Request #1304 Ā· dfinity/ic Ā· GitHub

1 Like