0

Error: Compiler error (C:\Users\circleci\project\libsolidity\codegen\CompilerUtils.cpp:1459):Stack too deep. Try compiling with --via-ir (cli) or the equivalent viaIR: true (standard JSON) while enabling the optimizer. Otherwise, try removing local variables. CompilerError: Stack too deep. Try compiling with --via-ir (cli) or the equivalent viaIR: true (standard JSON) while enabling the optimizer. Otherwise, try removing local variables.

1
  • As mentioned in the error, use --via-ir flag with the compile command. Commented May 9 at 16:59

1 Answer 1

0

Funny, i'm facing the same issue.

It's likely because you have too many local variables

Here are answers I found:

https://stackoverflow.com/questions/74578910/how-to-fix-compilererror-stack-too-deep-try-compiling-with-via-ir-cli

And indeed, i had a struct with too many variables. I reduced it (with an array, instead of 5 separate values) and it got fixed !

1
  • I stopped using array inside struct too. But still getting the same error and I need to have too many variables inside struct and locally so I just run with "--via-ir" that works fine for now will look into it more in future. I look into foundry book might get something from there. Commented May 10 at 15:42

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