stack level too deep

It almost certainly means you have an (unintentional?) recursion in
your code (a function that calls itself, which calls itself, etc...):

def recurse

Every time a function is called, a new frame is added on the stack. At
some point, the Ruby interpreter decides that you have way too many
stack frames and throws that error.

If you want to post the offending piece of code, we might be able to
help with more specifics.