# httpx.ConnectError: All connection attempts failed
During handling of the above exception, another exception occurred:
httpx.HTTPStatusError: Client error '404 Not Found' for url 'https://api.example.com/v1/users'

- **ID:** `python/pytest-httpx-mock-not-matched`
- **Domain:** python
- **Category:** network_error
- **Verification:** ai_generated
- **Fix Rate:** 80%

## Root Cause

respx/httpx mock was registered with a URL pattern that does not match the actual request (trailing slash, query string, or http vs https), so the request falls through to the real network.

## Version Compatibility

| Version | Status | Introduced | Deprecated |
|---------|--------|------------|------------|
| 0.21.x | active | — | — |
| 0.22.x | active | — | — |

## Workarounds

1. **** (93% success)
   ```
   import respx, httpx

@respx.mock
async def test_users():
    respx.get(url__regex=r'/v1/users.*').mock(
        return_value=httpx.Response(200, json={'id': 1})
    )
    async with httpx.AsyncClient(base_url='https://api.example.com') as c:
        r = await c.get('/v1/users')
        assert r.status_code == 200
   ```
2. **** (88% success)
   ```
   respx.get('https://api.example.com/v1/users').mock(...)
# Enable debug:
import logging
logging.basicConfig(level=logging.DEBUG)
# Look for 'No mock matched' in output
   ```

## Dead Ends

- **** — Disabling assertions hides the mismatch but the request still goes to the real network and fails with ConnectError. (85% fail)
- **** — The failure is not a timeout; the URL never matches a registered route so no mock intercepts it. (90% fail)
