I have a function that looks like this:

function foo(uint _someVar, bytes calldata _data) public {

Then I make a call to it from another function with "" as _data:

foo(123, "");

"" seems to be the default way to pass blank bytes. However, I get this truffle compilation error:

TypeError: Invalid type for argument in function call. Invalid implicit conversion from literal_string "" to bytes calldata requested.

I have tried to declare and pass variables, but it all comes down to trying to assign blank calldata bytes. Any tips on how to do this?

  • 4
    Use new bytes(0).
    – Ismael
    May 3, 2021 at 7:52

2 Answers 2


Try to use "0x". It helps me.

  • This worked. It's so stupid that an empty string won't. Jul 8, 2023 at 23:30
bytes memory data = new bytes(0);
  • 1
    While this seems to answer the question, please avoid code only answer. Jun 18, 2022 at 4:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.