I had similar issues with my v2 port - it was more about array syntax (Old {} syntax vs new Map() syntax) I seem to recall.
See my v2 branch here.
Closing this as I got the context mode to work, but feel free to re-open if you feel that it has not been solved
https://github.com/evilC/AutoHotInterception/blob/ca52f695ffd9d2826b8af04a79fcfd789b5a1f88/Lib/AutoHotInterception.ahk#L243 Was porting the most recent version to v2, and after altering the syntax, it threw me an error for a non-existing local variable, so I thought I'd mention it? (Cause I'm unsure whether it's supposed to not return anything, or if it's meant to return something else)