# aiohttp.client_exceptions.InvalidURL: URL should be absolute

- **ID:** `python/aiohttp-invalid-url-with-scheme`
- **Domain:** python
- **Category:** network_error
- **Verification:** ai_generated
- **Fix Rate:** 80%

## Root Cause

aiohttp requires fully qualified URLs including scheme and host; relative paths or strings missing http(s):// are rejected.

## Version Compatibility

| Version | Status | Introduced | Deprecated |
|---------|--------|------------|------------|
| 3.8 | active | — | — |
| 3.9 | active | — | — |
| 3.10 | active | — | — |
| 3.11 | active | — | — |

## Workarounds

1. **** (95% success)
   ```
   Use urllib.parse.urljoin to build an absolute URL:

from urllib.parse import urljoin
url = urljoin('https://api.example.com', '/v1/users')
async with session.get(url) as resp:
    ...
   ```
2. **** (90% success)
   ```
   Store full URLs in your config and validate at startup:

assert url.startswith(('http://', 'https://')), f'bad url: {url}'
   ```

## Dead Ends

- **** — base_url only affects redirects and links; session.get('/path') still raises InvalidURL. (70% fail)
- **** — Encoding does not add the missing scheme/host; the URL remains relative. (80% fail)
