2 months ago
IPv6 Feature Flag causes ENETUNREACH when connecting to hosts with AAAA records
Service: Python FastAPI (Railway Preview environment)
Feature flag: IPv6 (enabled via Settings → Feature Flags)
---
What happened
I enabled the IPv6 feature flag and simultaneously switched my Supabase DATABASE_URL from the connection pooler to the
direct DB host. The service immediately started failing on every database call with:
OSError: [Errno 101] Network is unreachable
The failure occurs at the TCP socket layer (SQLAlchemy → asyncpg → socket connect), before any SSL or auth negotiation.
The service crash-looped across multiple container restarts — the error was persistent, not transient.
Troubleshooting
I resolved the two hostnames from my local machine:
dig AAAA db.xhszgkrasrskvlfhuavt.supabase.co
→ AAAA 2600:1f16:1cd0:3320:348a:c3ba:f8a2:59c4 (real IPv6 address)
dig AAAA aws-1-us-east-2.pooler.supabase.com
→ CNAME to an AWS ELB with no AAAA record (IPv4 only)
Root cause
With IPv6 enabled, the Railway container gains an IPv6 interface. Python's getaddrinfo() returns the AAAA record for the
direct Supabase DB host, asyncpg attempts IPv6 first, and gets ENETUNREACH — Railway has no route to that AWS IPv6 address
(2600:1f16::.../us-east-1).
The pooler URL has no AAAA record, so Python falls back to IPv4 and connects successfully.
Confirmation
Reverting DATABASE_URL to the pooler (IPv4-only) URL fixed the issue without disabling the IPv6 feature flag. IPv6 is
still enabled and the service is healthy. This confirms the issue is specifically Railway's IPv6 routing being unable to
reach AWS IPv6 addresses — not a misconfiguration on my end.
Expected behavior
Either:
- IPv6 routing should have a working path to AWS IPv6 addresses, or
- asyncpg/Python should fall back to IPv4 when IPv6 yields ENETUNREACH (happy eyeballs), or
- the docs should note that IPv6 routing is incomplete and hosts with AAAA records may be unreachable
Workaround
Use a DATABASE_URL that resolves to IPv4 only (e.g. Supabase's connection pooler instead of the direct DB host).
6 Replies
2 months ago
We do not currently support outbound IPv6, as noted in our Outbound Networking docs - any outbound IPv6 request will fail with "Network is unreachable." Your workaround of using the IPv4-only pooler URL is the correct approach, and your analysis of the issue is spot on.
Status changed to Awaiting User Response Railway • about 2 months ago
2 months ago
Bot, I'm afraid you have outdated info. On Railway's own changelog we see:
https://railway.com/changelog/2026-02-27-smart-diagnosis
IPv6 support to Priority Boarding

Enable IPv6 for outbound connections on your services
New in Priority Boarding: Outbound IPv6
If you need to connect to external services that only expose IPv6 addresses, your Railway services can now reach them.
Since this changes networking behavior, it's opt-in. Enable it per service in your service settings. This covers outbound connections only, so public inbound connections still use IPv4.
Share your feedback on Central Station.
Status changed to Awaiting Railway Response Railway • about 2 months ago
Status changed to Awaiting User Response Railway • about 2 months ago
2 months ago
Yes, though I turned it back off because of the failures and went back to IPv4
Status changed to Awaiting Railway Response Railway • about 2 months ago
2 months ago
You had the feature flag on. I'm not asking about that. I am asking about the toggle switch in your service settings. I am not seeing any history that says you had that enabled.
Status changed to Awaiting User Response Railway • about 2 months ago
2 months ago
That was the issue. I didn't realize it had to be enabled two places. Thank you.
Status changed to Awaiting Railway Response Railway • about 2 months ago
Status changed to Solved ohcedar • about 2 months ago