Skip to content

fix(start): suggest recovery for exec format and backup migration failures#5937

Closed
rohanpatel2002 wants to merge 1 commit into
supabase:developfrom
rohanpatel2002:fix/start-exec-format-and-backup-diagnostics
Closed

fix(start): suggest recovery for exec format and backup migration failures#5937
rohanpatel2002 wants to merge 1 commit into
supabase:developfrom
rohanpatel2002:fix/start-exec-format-and-backup-diagnostics

Conversation

@rohanpatel2002

@rohanpatel2002 rohanpatel2002 commented Jul 23, 2026

Copy link
Copy Markdown

Summary

When supabase start health checks fail, detect common log patterns (exec format error, storage migrations_name_key, Studio ERR_INVALID_PACKAGE_CONFIG) and set CmdSuggestion with recovery steps. Also pin image pulls to linux/<host-arch> to reduce wrong-arch Mailpit starts.

Related: supabase/supabase#48224

Linked issue

Closes #REPLACE_WITH_CLI_ISSUE_NUMBER

  • The linked issue is open and carries the open-for-contribution label (or I'm a Supabase maintainer).

Checklist

  • The PR title follows Conventional Commits.
  • Tests added or updated for the change.
  • pnpm check:all and pnpm test pass for the workspace(s) I touched.

…lures

Surface actionable CmdSuggestion when unhealthy containers log exec format
error, storage migrations_name_key, or Studio ERR_INVALID_PACKAGE_CONFIG,
and pin image pulls to linux/<host-arch> to reduce wrong-arch Mailpit starts.
@rohanpatel2002
rohanpatel2002 requested a review from a team as a code owner July 23, 2026 09:14
@github-actions

Copy link
Copy Markdown
Contributor

👋 Thanks for the contribution! This pull request isn't linked to a tracked issue, so it's being closed automatically.

Please open an issue first, wait for a maintainer to add the open-for-contribution label, then open a pull request that links the issue with a closing keyword (e.g. Closes #123).
See CONTRIBUTING.md for the full workflow. Once a maintainer adds the open-for-contribution label to a linked open issue, reopen or open a new pull request and it will be accepted.

@github-actions github-actions Bot closed this Jul 23, 2026
@github-actions

Copy link
Copy Markdown
Contributor

👋 Thanks for the contribution! This pull request isn't linked to a tracked issue, so it's being closed automatically.

Please open an issue first, wait for a maintainer to add the open-for-contribution label, then open a pull request that links the issue with a closing keyword (e.g. Closes #123).
See CONTRIBUTING.md for the full workflow. Once a maintainer adds the open-for-contribution label to a linked open issue, reopen or open a new pull request and it will be accepted.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 4031555019

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

"A container failed with \"exec format error\" (wrong CPU architecture image).\n"+
"Try removing the mismatched images and restarting for linux/%s:\n"+
" %s\n"+
" docker image prune -f\n"+

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Remove tagged images for exec-format recovery

When the exec-format failure is caused by a tagged local image with the wrong architecture, this recovery leaves it in place: Docker documents that docker image prune removes dangling images by default and only removes other unused images with -a (https://docs.docker.com/reference/cli/docker/image/prune/), while DockerResolveImageIfNotCached returns any locally inspectable tag before reaching the new platform-pinned pull. After supabase stop --no-backup && docker image prune -f, supabase start can reuse the same tagged wrong-arch image and hit exec format error again; the hint should remove the affected Supabase image tag(s) or force a platform-aware repull.

Useful? React with 👍 / 👎.

parts = append(parts, fmt.Sprintf(
"Studio image looks corrupted or incomplete. Remove it and re-pull:\n"+
" %s\n"+
" docker image rm -f $(docker images -q supabase/studio) 2>/dev/null\n"+

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Remove mirrored Studio images too

For the default registry path, Studio is cached as public.ecr.aws/supabase/studio (and the fallback can be ghcr.io/supabase/studio), but this command only asks Docker for the exact repository supabase/studio; Docker's image-list docs state the [REPOSITORY[:TAG]] argument must be an exact match (https://docs.docker.com/reference/cli/docker/image/ls/). In the corrupted default/fallback image scenario the command produces no IDs, removes nothing, and the next supabase start reuses the broken Studio image, so the hint should match the configured/mirrored repository names instead of only Docker Hub.

Useful? React with 👍 / 👎.

RegistryAuth: GetRegistryAuthForImage(imageTag),
// Prefer the host architecture so services like mailpit do not start
// with a wrong-arch binary (exec format error). See supabase/supabase#48224.
Platform: "linux/" + runtime.GOARCH,

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Use the Docker daemon architecture

When the CLI talks to a Docker daemon with a different architecture than the CLI binary, such as an amd64 CLI using a remote arm64 Docker context/DOCKER_HOST or Rosetta, this forces pulls to linux/<runtime.GOARCH>. Docker's pull option explicitly sets the platform (https://docs.docker.com/reference/cli/docker/image/pull/), so the daemon can receive an image for the client architecture rather than the daemon architecture and then fail to run it without emulation; derive the platform from the daemon or make the override conditional.

Useful? React with 👍 / 👎.

fmt.Fprintln(os.Stderr, logErr)
}
}
if suggestion := SuggestFromUnhealthyLogs(logBuf.String()); len(suggestion) > 0 {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Scope destructive recovery hints to stack startup

When WaitForHealthyService is used for temporary containers outside supabase start (for example the db diff shadow database in apps/cli-go/internal/db/diff/shadow.go), this unconditional log scan can surface suggestions that tell users to run supabase stop --no-backup. In those contexts the local stack volume is not the failed resource, and following the hint can delete local development data unnecessarily; only add these recovery steps for local-stack startup checks or tailor them per caller.

Useful? React with 👍 / 👎.

RegistryAuth: GetRegistryAuthForImage(imageTag),
// Prefer the host architecture so services like mailpit do not start
// with a wrong-arch binary (exec format error). See supabase/supabase#48224.
Platform: "linux/" + runtime.GOARCH,

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Pin the compose pre-pull path too

In supabase start, the first pull attempt is pullImagesUsingCompose (apps/cli-go/internal/start/start.go:284), whose RetryClient.ImagePull forwards Docker's pull options without setting a platform; only images that compose skipped reach this new platform-pinned DockerImagePull. If the normal compose pre-pull is the path that fetches a wrong-arch tag, ensureImagesCached then sees the tag locally and never executes this pinned pull, so the Mailpit exec-format failure can still happen on an empty cache unless the compose pull path is pinned or disabled as well.

Useful? React with 👍 / 👎.

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.

1 participant