KMDHTTPError when running tests

Hi all,

I am quite new to algorand and I was following along well to the Digital Marketplace tutorial. I left my computer on Friday with all tests executing and now when I try and algokit project run test I get an KMDHTTPError. Full output below.

Is there anything that I can do? I tried upgrading algokit, but that did nothing and the documentation on this error seems to be too sparse to understand what could be going wrong.

······················ project run 'test' command output: ······················
============================= test session starts =============================
platform win32 -- Python 3.12.4, pytest-8.3.1, pluggy-1.5.0
rootdir: C:\Users\xxx\yyy\Documents\zzz\digital_marketplace\projects\digital_marketplace
configfile: pyproject.toml
plugins: anyio-4.4.0, cov-5.0.0
collected 4 items

tests\digital_marketplace_client_test.py EEEE                            [100%]

=================================== ERRORS ====================================
___________________ ERROR at setup of test_opt_in_to_asset ____________________

self = <algosdk.kmd.KMDClient object at 0x000001AEB0B43AD0>, method = 'GET'
requrl = '/v1/wallets', params = None, data = None, timeout = 30

    def kmd_request(self, method, requrl, params=None, data=None, timeout=30):
        """
        Execute a given request.

        Args:
            method (str): request method
            requrl (str): url for the request
            params (dict, optional): parameters for the request
            data (dict, optional): data in the body of the request
            timeout (int, optional): request timeout in seconds

        Returns:
            dict: loaded from json response body
        """
        if requrl in constants.no_auth:
            header = {}
        else:
            header = {constants.kmd_auth_header: self.kmd_token}

        if requrl not in constants.unversioned_paths:
            requrl = api_version_path_prefix + requrl
        if params:
            requrl = requrl + "?" + parse.urlencode(params)
        if data:
            data = json.dumps(data, indent=2)
            data = bytearray(data, "utf-8")
        req = Request(
            self.kmd_address + requrl, headers=header, method=method, data=data
        )
        resp = None
        try:
            resp = urlopen(req, timeout=timeout)
        except urllib.error.HTTPError as e:
            e = e.read().decode("utf-8")
            try:
>               raise error.KMDHTTPError(json.loads(e)["message"])

.venv\Lib\site-packages\algosdk\kmd.py:65:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
C:\Users\ddnl\AppData\Local\Programs\Python\Python312\Lib\json\__init__.py:346: in loads
    return _default_decoder.decode(s)
C:\Users\ddnl\AppData\Local\Programs\Python\Python312\Lib\json\decoder.py:337: in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <json.decoder.JSONDecoder object at 0x000001AEAD9BAD20>
s = '<html>\r\n<head><title>502 Bad Gateway</title></head>\r\n<body>\r\n<center><h1>502 Bad Gateway</h1></center>\r\n<hr><center>nginx/1.27.0</center>\r\n</body>\r\n</html>\r\n'
idx = 0

    def raw_decode(self, s, idx=0):
        """Decode a JSON document from ``s`` (a ``str`` beginning with
        a JSON document) and return a 2-tuple of the Python
        representation and the index in ``s`` where the document ended.

        This can be used to decode a JSON document from a string that may
        have extraneous data at the end.

        """
        try:
            obj, end = self.scan_once(s, idx)
        except StopIteration as err:
>           raise JSONDecodeError("Expecting value", s, err.value) from None
E           json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

C:\Users\ddnl\AppData\Local\Programs\Python\Python312\Lib\json\decoder.py:355: JSONDecodeError

During handling of the above exception, another exception occurred:

algorand = <algokit_utils.beta.algorand_client.AlgorandClient object at 0x000001AEB0C427E0>

    @pytest.fixture(scope = 'session')
    def dispenser(algorand: AlgorandClient) -> AddressAndSigner:
>       return algorand.account.dispenser()

tests\digital_marketplace_client_test.py:30:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
.venv\Lib\site-packages\algokit_utils\beta\account_manager.py:183: in dispenser
    acct = get_dispenser_account(self._client_manager.algod)
.venv\Lib\site-packages\algokit_utils\account.py:108: in get_dispenser_account
    return get_localnet_default_account(client)
.venv\Lib\site-packages\algokit_utils\account.py:98: in get_localnet_default_account
    account = get_kmd_wallet_account(
.venv\Lib\site-packages\algokit_utils\account.py:119: in get_kmd_wallet_account
    wallets: list[dict] = kmd_client.list_wallets()  # type: ignore[no-untyped-call]
.venv\Lib\site-packages\algosdk\kmd.py:88: in list_wallets
    res = self.kmd_request("GET", req, **kwargs)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <algosdk.kmd.KMDClient object at 0x000001AEB0B43AD0>, method = 'GET'
requrl = '/v1/wallets', params = None, data = None, timeout = 30

    def kmd_request(self, method, requrl, params=None, data=None, timeout=30):
        """
        Execute a given request.

        Args:
            method (str): request method
            requrl (str): url for the request
            params (dict, optional): parameters for the request
            data (dict, optional): data in the body of the request
            timeout (int, optional): request timeout in seconds

        Returns:
            dict: loaded from json response body
        """
        if requrl in constants.no_auth:
            header = {}
        else:
            header = {constants.kmd_auth_header: self.kmd_token}

        if requrl not in constants.unversioned_paths:
            requrl = api_version_path_prefix + requrl
        if params:
            requrl = requrl + "?" + parse.urlencode(params)
        if data:
            data = json.dumps(data, indent=2)
            data = bytearray(data, "utf-8")
        req = Request(
            self.kmd_address + requrl, headers=header, method=method, data=data
        )
        resp = None
        try:
            resp = urlopen(req, timeout=timeout)
        except urllib.error.HTTPError as e:
            e = e.read().decode("utf-8")
            try:
                raise error.KMDHTTPError(json.loads(e)["message"])
            except:
>               raise error.KMDHTTPError(e)
E               algosdk.error.KMDHTTPError: <html>

E               <head><title>502 Bad Gateway</title></head>

E               <body>

E               <center><h1>502 Bad Gateway</h1></center>

E               <hr><center>nginx/1.27.0</center>

E               </body>

E               </html>

.venv\Lib\site-packages\algosdk\kmd.py:67: KMDHTTPError
_______________________ ERROR at setup of test_deposit ________________________

self = <algosdk.kmd.KMDClient object at 0x000001AEB0B43AD0>, method = 'GET'
requrl = '/v1/wallets', params = None, data = None, timeout = 30

    def kmd_request(self, method, requrl, params=None, data=None, timeout=30):
        """
        Execute a given request.

        Args:
            method (str): request method
            requrl (str): url for the request
            params (dict, optional): parameters for the request
            data (dict, optional): data in the body of the request
            timeout (int, optional): request timeout in seconds

        Returns:
            dict: loaded from json response body
        """
        if requrl in constants.no_auth:
            header = {}
        else:
            header = {constants.kmd_auth_header: self.kmd_token}

        if requrl not in constants.unversioned_paths:
            requrl = api_version_path_prefix + requrl
        if params:
            requrl = requrl + "?" + parse.urlencode(params)
        if data:
            data = json.dumps(data, indent=2)
            data = bytearray(data, "utf-8")
        req = Request(
            self.kmd_address + requrl, headers=header, method=method, data=data
        )
        resp = None
        try:
            resp = urlopen(req, timeout=timeout)
        except urllib.error.HTTPError as e:
            e = e.read().decode("utf-8")
            try:
>               raise error.KMDHTTPError(json.loads(e)["message"])

.venv\Lib\site-packages\algosdk\kmd.py:65:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
C:\Users\ddnl\AppData\Local\Programs\Python\Python312\Lib\json\__init__.py:346: in loads
    return _default_decoder.decode(s)
C:\Users\ddnl\AppData\Local\Programs\Python\Python312\Lib\json\decoder.py:337: in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <json.decoder.JSONDecoder object at 0x000001AEAD9BAD20>
s = '<html>\r\n<head><title>502 Bad Gateway</title></head>\r\n<body>\r\n<center><h1>502 Bad Gateway</h1></center>\r\n<hr><center>nginx/1.27.0</center>\r\n</body>\r\n</html>\r\n'
idx = 0

    def raw_decode(self, s, idx=0):
        """Decode a JSON document from ``s`` (a ``str`` beginning with
        a JSON document) and return a 2-tuple of the Python
        representation and the index in ``s`` where the document ended.

        This can be used to decode a JSON document from a string that may
        have extraneous data at the end.

        """
        try:
            obj, end = self.scan_once(s, idx)
        except StopIteration as err:
>           raise JSONDecodeError("Expecting value", s, err.value) from None
E           json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

C:\Users\ddnl\AppData\Local\Programs\Python\Python312\Lib\json\decoder.py:355: JSONDecodeError

During handling of the above exception, another exception occurred:

algorand = <algokit_utils.beta.algorand_client.AlgorandClient object at 0x000001AEB0C427E0>

    @pytest.fixture(scope = 'session')
    def dispenser(algorand: AlgorandClient) -> AddressAndSigner:
>       return algorand.account.dispenser()

tests\digital_marketplace_client_test.py:30:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
.venv\Lib\site-packages\algokit_utils\beta\account_manager.py:183: in dispenser
    acct = get_dispenser_account(self._client_manager.algod)
.venv\Lib\site-packages\algokit_utils\account.py:108: in get_dispenser_account
    return get_localnet_default_account(client)
.venv\Lib\site-packages\algokit_utils\account.py:98: in get_localnet_default_account
    account = get_kmd_wallet_account(
.venv\Lib\site-packages\algokit_utils\account.py:119: in get_kmd_wallet_account
    wallets: list[dict] = kmd_client.list_wallets()  # type: ignore[no-untyped-call]
.venv\Lib\site-packages\algosdk\kmd.py:88: in list_wallets
    res = self.kmd_request("GET", req, **kwargs)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <algosdk.kmd.KMDClient object at 0x000001AEB0B43AD0>, method = 'GET'
requrl = '/v1/wallets', params = None, data = None, timeout = 30

    def kmd_request(self, method, requrl, params=None, data=None, timeout=30):
        """
        Execute a given request.

        Args:
            method (str): request method
            requrl (str): url for the request
            params (dict, optional): parameters for the request
            data (dict, optional): data in the body of the request
            timeout (int, optional): request timeout in seconds

        Returns:
            dict: loaded from json response body
        """
        if requrl in constants.no_auth:
            header = {}
        else:
            header = {constants.kmd_auth_header: self.kmd_token}

        if requrl not in constants.unversioned_paths:
            requrl = api_version_path_prefix + requrl
        if params:
            requrl = requrl + "?" + parse.urlencode(params)
        if data:
            data = json.dumps(data, indent=2)
            data = bytearray(data, "utf-8")
        req = Request(
            self.kmd_address + requrl, headers=header, method=method, data=data
        )
        resp = None
        try:
            resp = urlopen(req, timeout=timeout)
        except urllib.error.HTTPError as e:
            e = e.read().decode("utf-8")
            try:
                raise error.KMDHTTPError(json.loads(e)["message"])
            except:
>               raise error.KMDHTTPError(e)
E               algosdk.error.KMDHTTPError: <html>

E               <head><title>502 Bad Gateway</title></head>

E               <body>

E               <center><h1>502 Bad Gateway</h1></center>

E               <hr><center>nginx/1.27.0</center>

E               </body>

E               </html>

.venv\Lib\site-packages\algosdk\kmd.py:67: KMDHTTPError
______________________ ERROR at setup of test_set_price _______________________

self = <algosdk.kmd.KMDClient object at 0x000001AEB0B43AD0>, method = 'GET'
requrl = '/v1/wallets', params = None, data = None, timeout = 30

    def kmd_request(self, method, requrl, params=None, data=None, timeout=30):
        """
        Execute a given request.

        Args:
            method (str): request method
            requrl (str): url for the request
            params (dict, optional): parameters for the request
            data (dict, optional): data in the body of the request
            timeout (int, optional): request timeout in seconds

        Returns:
            dict: loaded from json response body
        """
        if requrl in constants.no_auth:
            header = {}
        else:
            header = {constants.kmd_auth_header: self.kmd_token}

        if requrl not in constants.unversioned_paths:
            requrl = api_version_path_prefix + requrl
        if params:
            requrl = requrl + "?" + parse.urlencode(params)
        if data:
            data = json.dumps(data, indent=2)
            data = bytearray(data, "utf-8")
        req = Request(
            self.kmd_address + requrl, headers=header, method=method, data=data
        )
        resp = None
        try:
            resp = urlopen(req, timeout=timeout)
        except urllib.error.HTTPError as e:
            e = e.read().decode("utf-8")
            try:
>               raise error.KMDHTTPError(json.loads(e)["message"])

.venv\Lib\site-packages\algosdk\kmd.py:65:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
C:\Users\ddnl\AppData\Local\Programs\Python\Python312\Lib\json\__init__.py:346: in loads
    return _default_decoder.decode(s)
C:\Users\ddnl\AppData\Local\Programs\Python\Python312\Lib\json\decoder.py:337: in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <json.decoder.JSONDecoder object at 0x000001AEAD9BAD20>
s = '<html>\r\n<head><title>502 Bad Gateway</title></head>\r\n<body>\r\n<center><h1>502 Bad Gateway</h1></center>\r\n<hr><center>nginx/1.27.0</center>\r\n</body>\r\n</html>\r\n'
idx = 0

    def raw_decode(self, s, idx=0):
        """Decode a JSON document from ``s`` (a ``str`` beginning with
        a JSON document) and return a 2-tuple of the Python
        representation and the index in ``s`` where the document ended.

        This can be used to decode a JSON document from a string that may
        have extraneous data at the end.

        """
        try:
            obj, end = self.scan_once(s, idx)
        except StopIteration as err:
>           raise JSONDecodeError("Expecting value", s, err.value) from None
E           json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

C:\Users\ddnl\AppData\Local\Programs\Python\Python312\Lib\json\decoder.py:355: JSONDecodeError

During handling of the above exception, another exception occurred:

algorand = <algokit_utils.beta.algorand_client.AlgorandClient object at 0x000001AEB0C427E0>

    @pytest.fixture(scope = 'session')
    def dispenser(algorand: AlgorandClient) -> AddressAndSigner:
>       return algorand.account.dispenser()

tests\digital_marketplace_client_test.py:30:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
.venv\Lib\site-packages\algokit_utils\beta\account_manager.py:183: in dispenser
    acct = get_dispenser_account(self._client_manager.algod)
.venv\Lib\site-packages\algokit_utils\account.py:108: in get_dispenser_account
    return get_localnet_default_account(client)
.venv\Lib\site-packages\algokit_utils\account.py:98: in get_localnet_default_account
    account = get_kmd_wallet_account(
.venv\Lib\site-packages\algokit_utils\account.py:119: in get_kmd_wallet_account
    wallets: list[dict] = kmd_client.list_wallets()  # type: ignore[no-untyped-call]
.venv\Lib\site-packages\algosdk\kmd.py:88: in list_wallets
    res = self.kmd_request("GET", req, **kwargs)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <algosdk.kmd.KMDClient object at 0x000001AEB0B43AD0>, method = 'GET'
requrl = '/v1/wallets', params = None, data = None, timeout = 30

    def kmd_request(self, method, requrl, params=None, data=None, timeout=30):
        """
        Execute a given request.

        Args:
            method (str): request method
            requrl (str): url for the request
            params (dict, optional): parameters for the request
            data (dict, optional): data in the body of the request
            timeout (int, optional): request timeout in seconds

        Returns:
            dict: loaded from json response body
        """
        if requrl in constants.no_auth:
            header = {}
        else:
            header = {constants.kmd_auth_header: self.kmd_token}

        if requrl not in constants.unversioned_paths:
            requrl = api_version_path_prefix + requrl
        if params:
            requrl = requrl + "?" + parse.urlencode(params)
        if data:
            data = json.dumps(data, indent=2)
            data = bytearray(data, "utf-8")
        req = Request(
            self.kmd_address + requrl, headers=header, method=method, data=data
        )
        resp = None
        try:
            resp = urlopen(req, timeout=timeout)
        except urllib.error.HTTPError as e:
            e = e.read().decode("utf-8")
            try:
                raise error.KMDHTTPError(json.loads(e)["message"])
            except:
>               raise error.KMDHTTPError(e)
E               algosdk.error.KMDHTTPError: <html>

E               <head><title>502 Bad Gateway</title></head>

E               <body>

E               <center><h1>502 Bad Gateway</h1></center>

E               <hr><center>nginx/1.27.0</center>

E               </body>

E               </html>

.venv\Lib\site-packages\algosdk\kmd.py:67: KMDHTTPError
_________________________ ERROR at setup of test_buy __________________________

self = <algosdk.kmd.KMDClient object at 0x000001AEB0B43AD0>, method = 'GET'
requrl = '/v1/wallets', params = None, data = None, timeout = 30

    def kmd_request(self, method, requrl, params=None, data=None, timeout=30):
        """
        Execute a given request.

        Args:
            method (str): request method
            requrl (str): url for the request
            params (dict, optional): parameters for the request
            data (dict, optional): data in the body of the request
            timeout (int, optional): request timeout in seconds

        Returns:
            dict: loaded from json response body
        """
        if requrl in constants.no_auth:
            header = {}
        else:
            header = {constants.kmd_auth_header: self.kmd_token}

        if requrl not in constants.unversioned_paths:
            requrl = api_version_path_prefix + requrl
        if params:
            requrl = requrl + "?" + parse.urlencode(params)
        if data:
            data = json.dumps(data, indent=2)
            data = bytearray(data, "utf-8")
        req = Request(
            self.kmd_address + requrl, headers=header, method=method, data=data
        )
        resp = None
        try:
            resp = urlopen(req, timeout=timeout)
        except urllib.error.HTTPError as e:
            e = e.read().decode("utf-8")
            try:
>               raise error.KMDHTTPError(json.loads(e)["message"])

.venv\Lib\site-packages\algosdk\kmd.py:65:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
C:\Users\ddnl\AppData\Local\Programs\Python\Python312\Lib\json\__init__.py:346: in loads
    return _default_decoder.decode(s)
C:\Users\ddnl\AppData\Local\Programs\Python\Python312\Lib\json\decoder.py:337: in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <json.decoder.JSONDecoder object at 0x000001AEAD9BAD20>
s = '<html>\r\n<head><title>502 Bad Gateway</title></head>\r\n<body>\r\n<center><h1>502 Bad Gateway</h1></center>\r\n<hr><center>nginx/1.27.0</center>\r\n</body>\r\n</html>\r\n'
idx = 0

    def raw_decode(self, s, idx=0):
        """Decode a JSON document from ``s`` (a ``str`` beginning with
        a JSON document) and return a 2-tuple of the Python
        representation and the index in ``s`` where the document ended.

        This can be used to decode a JSON document from a string that may
        have extraneous data at the end.

        """
        try:
            obj, end = self.scan_once(s, idx)
        except StopIteration as err:
>           raise JSONDecodeError("Expecting value", s, err.value) from None
E           json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

C:\Users\ddnl\AppData\Local\Programs\Python\Python312\Lib\json\decoder.py:355: JSONDecodeError

During handling of the above exception, another exception occurred:

algorand = <algokit_utils.beta.algorand_client.AlgorandClient object at 0x000001AEB0C427E0>

    @pytest.fixture(scope = 'session')
    def dispenser(algorand: AlgorandClient) -> AddressAndSigner:
>       return algorand.account.dispenser()

tests\digital_marketplace_client_test.py:30:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
.venv\Lib\site-packages\algokit_utils\beta\account_manager.py:183: in dispenser
    acct = get_dispenser_account(self._client_manager.algod)
.venv\Lib\site-packages\algokit_utils\account.py:108: in get_dispenser_account
    return get_localnet_default_account(client)
.venv\Lib\site-packages\algokit_utils\account.py:98: in get_localnet_default_account
    account = get_kmd_wallet_account(
.venv\Lib\site-packages\algokit_utils\account.py:119: in get_kmd_wallet_account
    wallets: list[dict] = kmd_client.list_wallets()  # type: ignore[no-untyped-call]
.venv\Lib\site-packages\algosdk\kmd.py:88: in list_wallets
    res = self.kmd_request("GET", req, **kwargs)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <algosdk.kmd.KMDClient object at 0x000001AEB0B43AD0>, method = 'GET'
requrl = '/v1/wallets', params = None, data = None, timeout = 30

    def kmd_request(self, method, requrl, params=None, data=None, timeout=30):
        """
        Execute a given request.

        Args:
            method (str): request method
            requrl (str): url for the request
            params (dict, optional): parameters for the request
            data (dict, optional): data in the body of the request
            timeout (int, optional): request timeout in seconds

        Returns:
            dict: loaded from json response body
        """
        if requrl in constants.no_auth:
            header = {}
        else:
            header = {constants.kmd_auth_header: self.kmd_token}

        if requrl not in constants.unversioned_paths:
            requrl = api_version_path_prefix + requrl
        if params:
            requrl = requrl + "?" + parse.urlencode(params)
        if data:
            data = json.dumps(data, indent=2)
            data = bytearray(data, "utf-8")
        req = Request(
            self.kmd_address + requrl, headers=header, method=method, data=data
        )
        resp = None
        try:
            resp = urlopen(req, timeout=timeout)
        except urllib.error.HTTPError as e:
            e = e.read().decode("utf-8")
            try:
                raise error.KMDHTTPError(json.loads(e)["message"])
            except:
>               raise error.KMDHTTPError(e)
E               algosdk.error.KMDHTTPError: <html>

E               <head><title>502 Bad Gateway</title></head>

E               <body>

E               <center><h1>502 Bad Gateway</h1></center>

E               <hr><center>nginx/1.27.0</center>

E               </body>

E               </html>

.venv\Lib\site-packages\algosdk\kmd.py:67: KMDHTTPError
=========================== short test summary info ===========================
ERROR tests/digital_marketplace_client_test.py::test_opt_in_to_asset - algosdk.error.KMDHTTPError: <html>

ERROR tests/digital_marketplace_client_test.py::test_deposit - algosdk.error.KMDHTTPError: <html>

ERROR tests/digital_marketplace_client_test.py::test_set_price - algosdk.error.KMDHTTPError: <html>

ERROR tests/digital_marketplace_client_test.py::test_buy - algosdk.error.KMDHTTPError: <html>

============================== 4 errors in 1.40s ==============================

Many thanks,

1 Like

Ok so I fixed this by running the boostrap command algokit project bootstrap all and resetting localnet algokit generate env-file -a target_network localnet and the environmental variables for localnet algokit generate env-file -a target_network localnet