The "three errors" are not three separate errors; it's called a "backtrace". What you have is one line with an error (the first line of code). The rest of the backtrace "traces" back through the chain of function/method calls that resulted in the bad call, to help you figure out where things went wrong along the way.

At some point in that chain, either the value of x or y becomes more than the bounds of the map array. It might be helpful first to know which one, and also to trace the values you're putting into the create_v_tunnel to begin with. Print statements or a debugger are helpful tools here.