On versions older than 2022.10.0, the (experimental) bootstrap endpoint does not exist. The HTTP request returns 404, but produce_bootstrap_output() returns successfully but with an empty API key. That's because the case that checks for the 404 status just adds a "message": https://github.com/posit-dev/rsconnect-python/blob/main/rsconnect/json_web_token.py#L127-L131.
bootstrap should either return an API key and exit 0, or if no key is returned, for whatever reason, it should exit 1.