As the headline says the macro result-or-error relies on the global var *ssh-connection*. However, this variable does not has to be initialized as you can pass your own sessions to functions and do not need to rely on this global variable. E.g. in case of threading the *ssh-connection* is NIL for a (new) thread even though you use the the with-ssh-connection macro in the parent thread, subsequently if you pass the session to the thread you can run into this problem.
This results for rare case in (session *ssh-connection*) being called even though *ssh-connection* is NIL, thus a very baffling exception.