That is it.
It was a permissions issue on the key_file.txt file which wasn't written to throw an error if it wasn't opened. How embarrassing. But at least there is a solution.
I learn more and more about less and less until eventually I know everything about nothing.