## TL;DR

Use the async client as a context manager, async with genai.Client(...).aio, so the session closes cleanly at the end of the block. The root cause is that the async client holds an aiohttp session that needs an async context manager to close cleanly.

## Steps

1. After upgrading google-genai to v1.37, async users started seeing `Unclosed client session` and `Unclosed connector` warnings at shutdown. The root cause is that the async client holds an aiohttp session that needs an async context manager to close cleanly. A maintainer showed the correct pattern: `async with genai.Client(...).aio`. The reporter later confirmed the warnings were gone in v1.52.0.

2. Those warnings mean the async client's underlying aiohttp session was never closed, and they started appearing for async users after v1.37. Use the async client as a context manager, `async with genai.Client(...).aio`, so the session closes cleanly at the end of the block. The reporter confirmed the issue was gone in v1.52.0, so also make sure you are on a recent release. If you see this on old code, wrapping the client usage in the async context manager is the fix.

3. Take the question above and check if it matches what you're seeing. If it does, work through the verified fix step by step. Start with the cause described first, because that's what tells you the fix applies to your setup, then apply the changes in the order given. Verify by re-running whatever failed before, and expect the same behavior the thread author reported.

## When to use

You are seeing this: After upgrading google-genai to v1.37, async users started seeing Unclosed client session and Unclosed connector warnings at shutdown. Use this skill when you run into "Unclosed client session and Unclosed connector warnings after upgrading to v1.37".

## When not to use

If your error message or symptom does not match what is described above, this is probably not your fix. Search for your exact error text instead of forcing this one to fit.

## Versions

Versions mentioned in the source: v1.37, v1.52.0. If you are on something much newer or older, the details may have shifted.

## Why this happens

The original report does not dig into a root cause. It documents the symptom and the fix that resolved it.
