The first thing I would do is wrap give each block it's own magic tag. There are some subtle bugs that will appear if you start multiple blocks in a single magic tag, especially when you get into live binding.
So instead of this:
Do this:
I find the easiest way to debug EJS is using Chrome's debugger. If you go to the "Sources" tabs and click the arrow in the top left, you'll get a list of all of the scripts on a page. At the very bottom of this list will be the compiled version of your EJS templates.
Select that file and click the "{ }" button at the bottom of the tool to uncompress the script. When you encounter an error, it should be able to give you the exact line number it occurred in the EJS file. You can also set breakpoints like you would in a normal script.