Perform Script On Server (PSoS) is a different beast to debug.
As it creates an entirely new session, context and global variables are lost when such a PSoS script is called.
I was well aware of this and was still caught by surprise for something I had overlooked completely;
This was in a series of nested scripts where at some point one (lengthy) subscript is set for PSoS. But when the scripts preceding the PSoS script do not have an explicit commit step, that data is not yet available when PSoS kicks in.
It took me a while before I figured this out, so I think it may help others who fall into the same trap.
Also used some temporary steps that you can insert all over the place to get a sort of "debugger" for PSoS.