The server crashes and returns an 500 internal server error if the apikey query parameter is missing from URL in the /init, /ctl, /pm, and /cleanup endpoints
The code attempts to concatenate the apikey (which is None when missing) with the directory string, which raises a Typererror. Instead it should have just keep running with an error like 400 bad request rather than crashing.