Skip to content

fix(cli): detect IPv6 connectivity errors and suggest the IPv4 pooler#5493

Open
avallete wants to merge 2 commits into
developfrom
claude/brave-maxwell-YoIfd
Open

fix(cli): detect IPv6 connectivity errors and suggest the IPv4 pooler#5493
avallete wants to merge 2 commits into
developfrom
claude/brave-maxwell-YoIfd

Conversation

@avallete
Copy link
Copy Markdown
Member

@avallete avallete commented Jun 5, 2026

Closes CLI-1593

What

When a database host resolves to an IPv6-only address and the network (or the Docker container) has no IPv6 route, the CLI now detects the failure and tells the user to connect through the IPv4 connection pooler:

Your network does not support IPv6, which is required for direct connections to the database.
Run supabase link to connect through the IPv4 connection pooler instead.

Why

Supabase direct database connections (db.<ref>.supabase.co:5432) are IPv6-only unless the IPv4 add-on is enabled. Users on IPv4-only networks previously hit confusing failures:

  • In-process commands (db push / db pull, migration repair) surfaced network is unreachable with no hint, or no route to host misreported as "make sure your project exists".
  • supabase db dump runs pg_dump inside a Docker container whose stderr is streamed to the terminal but never classified, so the real connection error only showed up as error running container: exit 1 — the exact symptom reported in CLI-1593.

How

  • SetConnectSuggestion (internal/utils/connect.go) now recognizes the IPv6 signatures: network is unreachable, no route to host against a bracketed IPv6 literal, and libpq's Address family for hostname not supported. It's ordered before the existing no route to host / Tenant or user not found branch, and the literal/phrase gating keeps genuine project-not-found and Supavisor tenant errors on their existing suggestion.
  • db dump (internal/db/dump/dump.go) tees the container's stderr into a buffer and, on failure, runs it through SetConnectSuggestion so the IPv6 guidance surfaces instead of the bare container exit code.

Notes

  • These db commands are still proxied to the bundled Go binary, so the fix lives in apps/cli-go; the TS proxy forwards the suggestion on stderr unchanged.
  • A fuller IPv6 detect-and-retry mechanism (auto-falling back to the pooler) remains a possible follow-up; this change is the actionable-error-message improvement called for in the issue.

https://claude.ai/code/session_01UaPk7dGPmiCqoKJHyV7SLz


Generated by Claude Code

@avallete avallete requested a review from a team as a code owner June 5, 2026 19:43
Supabase direct database connections (db.<ref>.supabase.co:5432) are
IPv6-only unless the IPv4 add-on is enabled. Users on IPv4-only networks
hit confusing failures:

- in-process commands (db push/pull, migration repair) surfaced "network
  is unreachable" with no hint, or "no route to host" misreported as
  "make sure your project exists".
- `supabase db dump` runs pg_dump inside a Docker container whose stderr
  is streamed to the terminal but never classified, so the connection
  failure only showed up as "error running container: exit 1".

Detect the IPv6 signatures (network unreachable / no route to an IPv6
literal / libpq "Address family for hostname not supported") and point
the user at the IPv4 connection pooler via `supabase link`. For db dump,
tee the container's stderr so the failure can be classified after the
generic container exit code.

https://claude.ai/code/session_01UaPk7dGPmiCqoKJHyV7SLz
@avallete avallete force-pushed the claude/brave-maxwell-YoIfd branch from ae9ab9c to 2156bff Compare June 5, 2026 19:47
@coveralls
Copy link
Copy Markdown

coveralls commented Jun 5, 2026

Coverage Report for CI Build 27054386938

Warning

Build has drifted: This PR's base is out of sync with its target branch, so coverage data may include unrelated changes.
Quick fix: rebase this PR. Learn more →

Warning

No base build found for commit dd8e1b7 on develop.
Coverage changes can't be calculated without a base build.
If a base build is processing, this comment will update automatically when it completes.

Coverage: 64.121%

Details

  • Patch coverage: No coverable lines changed in this PR.

Uncovered Changes

No uncovered changes found.

Coverage Regressions

Requires a base build to compare against. How to fix this →


Coverage Stats

Coverage Status
Relevant Lines: 15912
Covered Lines: 10203
Line Coverage: 64.12%
Coverage Strength: 7.11 hits per line

💛 - Coveralls

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Jun 5, 2026

Supabase CLI preview

npx --yes https://pkg.pr.new/supabase@5493

Preview package for commit 8ed0c57.

A real-world db dump on an IPv4-only network surfaced
"could not translate host name ... to address: No address associated
with hostname" (getaddrinfo EAI_NODATA): the host is IPv6-only and the
container has no IPv6 stack, so AI_ADDRCONFIG filters out the AAAA
record. The previous detection only matched the address-family variant,
so the IPv6 suggestion never fired.

Match the EAI_NODATA message too, and cover it with the existing
connect-suggestion and db dump tests.

https://claude.ai/code/session_01UaPk7dGPmiCqoKJHyV7SLz
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants