{"record":{"id":"bd1be950d1d3f8bb","repo":"microsoft/semantic-kernel","slug":"astra-db-not-available-status-response","errorCode":null,"errorMessage":"Astra DB not available. Status : {response}","messagePattern":"Astra DB not available\\. Status : (.+?)","errorType":"exception","errorClass":"ServiceResponseException","httpStatus":null,"severity":"error","filePath":"python/semantic_kernel/connectors/memory_stores/astradb/astra_client.py","lineNumber":59,"sourceCode":"        )\n        self.request_header = {\n            \"x-cassandra-token\": self.astra_application_token,\n            \"Content-Type\": \"application/json\",\n            \"User-Agent\": ASTRA_CALLER_IDENTITY,\n        }\n        self._session = session\n\n    async def _run_query(self, request_url: str, query: dict):\n        async with (\n            AsyncSession(self._session) as session,\n            session.post(request_url, data=json.dumps(query), headers=self.request_header) as response,\n        ):\n            if response.status == 200:\n                response_dict = await response.json()\n                if \"errors\" in response_dict:\n                    raise ServiceResponseException(f\"Astra DB request error - {response_dict['errors']}\")\n                return response_dict\n            raise ServiceResponseException(f\"Astra DB not available. Status : {response}\")\n\n    async def find_collections(self, include_detail: bool = True):\n        \"\"\"Finds all collections in the keyspace.\"\"\"\n        query = {\"findCollections\": {\"options\": {\"explain\": include_detail}}}\n        result = await self._run_query(self.request_base_url, query)\n        return result[\"status\"][\"collections\"]\n\n    async def find_collection(self, collection_name: str):\n        \"\"\"Finds a collection in the keyspace.\"\"\"\n        collections = await self.find_collections(False)\n        found = False\n        for collection in collections:\n            if collection == collection_name:\n                found = True\n                break\n        return found\n\n    async def create_collection(","sourceCodeStart":41,"sourceCodeEnd":77,"githubUrl":"https://github.com/microsoft/semantic-kernel/blob/c028a0c7dc4f0814cdcbaba9d998f187a41197bf/python/semantic_kernel/connectors/memory_stores/astradb/astra_client.py#L41-L77","documentation":"Raised by `AstraClient._run_query` when the HTTP response status is not 200. Unlike the 200-with-errors case, this indicates the request never succeeded at the transport/HTTP layer. The full response object (including its status) is embedded in the `ServiceResponseException` message.","triggerScenarios":"Astra REST API returns a non-200 status for any query: 401/403 for auth/token problems, 404 for a wrong base URL or API path, 429 for rate limiting, 5xx for Astra outages, or a connection that resolves to a different host returning an arbitrary status.","commonSituations":"Expired or invalid Astra application token (401/403); wrong database id/region in the request URL (404); Astra regional outage or maintenance window (5xx); rate limit exceeded (429); corporate proxy/firewall returning a blocking status; DNS misconfiguration.","solutions":["Check the embedded status code: 401/403 -> rotate/fix the app token; 404 -> verify db id/region/endpoint URL; 429 -> back off and retry; 5xx -> retry with backoff or check Astra status page.","Regenerate the Astra application token and confirm `ASTRA_DB_APP_TOKEN` / the token arg is current.","Verify the Astra database id and region used to build `AstraDBSettings`.","Retry transient failures (5xx, 429) with exponential backoff; treat 4xx (except 429) as permanent.","Ensure no proxy is intercepting the request with a non-200 status."],"exampleFix":"// before\nclient = AstraClient(..., astra_application_token=stale_token)\nawait client.find_collections()\n\n// after\nclient = AstraClient(..., astra_application_token=fresh_token)\ntry:\n    await client.find_collections()\nexcept ServiceResponseException as e:\n    if \"Status : <Response ... 401>\" in str(e):\n        raise RuntimeError(\"refresh Astra token\") from e\n    raise","handlingStrategy":"retry","validationCode":"# validate connectivity/config before heavy use\nimport aiohttp\nasync def astra_reachable(base_url, token):\n    headers = {\"X-Cassandra-Token\": token}\n    async with aiohttp.ClientSession() as s:\n        async with s.post(base_url, headers=headers, json={}) as r:\n            return r.status == 200 or r.status == 400  # 400 still means reachable","typeGuard":null,"tryCatchPattern":"from semantic_kernel.exceptions import ServiceResponseException\nimport asyncio\n\nasync def call_with_retry(fn, *a, **kw):\n    for attempt in range(5):\n        try:\n            return await fn(*a, **kw)\n        except ServiceResponseException as e:\n            s = str(e)\n            if \"Status\" in s and any(c in s for c in (\"401\", \"403\", \"404\")):\n                raise  # permanent\n            await asyncio.sleep(2 ** attempt)  # 5xx/429 -> backoff\n    raise","preventionTips":["Store the Astra token in a secret manager and refresh before expiry.","Verify the database id/region used to build the request URL.","Retry only transient (5xx, 429) statuses; fail fast on auth/404.","Monitor Astra status pages for regional outages."],"tags":["astra-db","http-status","network","auth","service-response","semantic-kernel"],"backgroundTag":null,"analyzedSha":"c028a0c7dc4f0814cdcbaba9d998f187a41197bf","analyzedAt":"2026-08-13T13:48:05.040Z","schemaVersion":2},"datasetVersion":"2026-08-13T14:17:21.547Z"}