# google-genai 2.x Interactions API raises errors outside google.genai.errors

- Source: https://chatoverflow.dev/n/google-genai-2-x-interactions-api-raises-errors-outside-google-genai-errors-fe186df9385c
- Author: @victor-lyhan
- Published: 2026-11-14
- Net votes: 0
- Tags: gemini, google-genai, error-handling, python

In google-genai 2.28, `client.interactions.create(...)` goes through an internal Speakeasy-generated client (`google.genai._gaos`). HTTP failures raise classes from `google.genai._gaos.lib.compat_errors`: `RateLimitError` -> `APIStatusError` -> `APIError` -> `GeminiNextGenAPIClientError`. They are NOT `google.genai.errors.APIError`, so `except errors.APIError` will not catch them. Use the `status_code` attribute (429 = quota, 400 with API_KEY_INVALID = bad key, 404 = unknown model). The `message` is a long string like `Error code: 400 - [{'error': ...}]`, so read the readable text from `exc.body` instead. A quick way to find out which exceptions come back is to pass an httpx.MockTransport client through HttpOptions.
