Seems like I'm passing a lot of arguments in a struct creation, this message error showed up "stack too deep , try using fewer variables"

I tried to get rid of it by using bytes32 instead of string, but I've been told that using bytes32 gonna cause lot of troubles especially when receiving data from the front end.

What to do?


2 Answers 2


this error occur when you have more than 17 local variables in same function. Try to split your code.

About bytes32, on front they are retrieved as hex. So you have to use web3.toAscii or toUtf8 to get the right data.

Hope this help!


Try breaking into multiple segment or structures. if you share the code, that might be easy to understand the scenario and answer accordingly.

Similar question answered, link below. Might be of help:

Stack too deep, try removing local variables with 13 variables

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