Skip to content

fix(cli)!: give functions serve failures typed errors - #7506

Merged
Prashansa-K merged 6 commits into
nextfrom
fix/serve-typed-errors
Nov 5, 2026
Merged

Prashansa-K merged 6 commits into
nextfrom
fix/serve-typed-errors

Conversation

@Prashansa-K

@Prashansa-K Prashansa-K commented Nov 5, 2026 •

Copy link
Copy Markdown
Contributor

TL;DR

functions serve reported its config, env-file, env-staging and Docker bring-up failures as a plain Error, so all of them shared one unclassified error. They now use typed errors with a reason set where the error is built; Docker reasons are read from Docker's output at that point.

What changed

  • ServeConfigError: invalid --inspect flags or a missing local import.
  • ServeEnvError: the env file is missing, can't be read or doesn't parse, or an env file or configured secret has an invalid variable name.
  • ServeFilesystemError: staging the env files fails.
  • EdgeRuntimeDockerStepError: docker create, cp or start for the Edge Runtime container fails. The reason is one of: daemon not running, port in use, container name conflict, mount denied, disk full, or other. "Other" is classified as a runtime crash and fingerprinted by step.
  • DockerResourceCreateError: Docker network or volume creation fails. The reason is one of: daemon not running, address pool exhausted, or other.
  • New fingerprint suffixes: disk_full and engine_command_copy.
  • The Edge Runtime Docker step span records edge_runtime.docker_step and edge_runtime.failure_reason.
  • Each site keeps its exact message.

Behaviour change

Breaking for scripts that read the JSON error envelope: with --output json, error.code for these failures is now the new error name instead of UnknownError. This applies to:

  • functions serve
  • in supabase start: a malformed supabase/functions/.env, the missing-import check, and the Edge Runtime container
  • in functions deploy: Docker network and volume creation

Env-file failures in start and functions serve kept the plain error in #7499; they now report ServeEnvError. The stack backend is unchanged.

When Docker isn't running during the container steps, a start-Docker suggestion replaces the generic --debug hint. Messages and exit codes are unchanged.

Linked issue

None

🤖 Generated with Claude Code

Prashansa-K and others added 4 commits November 5, 2026 15:09
`functions serve` reported its config, env-file, signing-key, env-staging
and Docker bring-up failures as a plain `Error`, so they all shared one
unclassified fingerprint. Each site now fails with a typed error that
carries a closed `reason` set where the error is built:

- ServeConfigError, ServeEnvFileError, ServeFilesystemError
- EdgeRuntimeDockerStepError (create/cp/start) and DockerResourceCreateError
  (network/volume), classified from Docker's stderr at construction

Messages and exit codes are unchanged. A daemon-unreachable failure during
those Docker steps now shows a start-Docker suggestion.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
A missing explicit --env-file now reports reason not_found; other read
failures keep their filesystem cause and parse failures report syntax.
Legacy start and functions serve report ServeEnvFileError instead of a
plain error.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…ehaviour

Docker step cases state their expected fingerprint and suggestion in the
table, with daemon_down and start rows added. Inspect flag, multiline env
name and directory env-file cases assert the typed error code. The serve
telemetry note no longer claims per-step fingerprints for filesystem
failures, and deploy documents the Docker network and volume error code.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Signing-key, jwt_secret and deno_version failures are rejected by shared
config validation before serve's own checks run, so the typed variants
were unreachable. Serve keeps its plain errors for them, with messages
unchanged.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@Prashansa-K
Prashansa-K requested a review from a team as a code owner November 5, 2026 09:39

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🤖 AI Review

Verified all three Claude findings: two minor documentation/remediation concerns and one error-naming nit. The Docker-hint finding is narrowed to socket-permission failures; missing executables fail earlier. Codex's independent review completed with no findings. Verification was by code inspection; tests were not run.

Findings

Severity Location Category Sources Claim
🟡 MINOR apps/cli/src/commands/start/start.integration.test.ts:5715 documentation claude The PR changes JSON error codes and Docker remediation hints for supabase start without updating that command's SIDE_EFFECTS.md.
🟡 MINOR apps/cli/src/shared/functions/serve.errors.ts:257 error-messages claude Docker socket-permission failures receive the new 'Start Docker' suggestion even when Docker is already running; starting Docker does not resolve the access problem.
⚪ NIT apps/cli/src/shared/functions/serve.ts:1748 error-classification claude An invalid multiline secret name from config.toml is labeled ServeEnvFileError even though the failing value need not originate in an env file.

Stats

Claude findings: 3 · Codex findings: 0 · Confirmed: 3 · Refuted: 0 · Uncertain: 0


Models: claude-opus-5-5 + gpt-6.1-sol · Trigger: auto · Workflow run

This review runs once per PR. A maintainer can request another with a /ai-review comment.

Comment thread apps/cli/src/shared/functions/serve.ts Resolved
Prashansa-K and others added 2 commits November 5, 2026 15:18
… suggestion

Document the typed bring-up errors in start's SIDE_EFFECTS.md, say that
ServeEnvFileError also covers configured secrets, and make the start-Docker
suggestion cover an inaccessible Docker socket.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
The error also covers invalid names from configured secrets, so a
source-neutral name fits. The class is unreleased, so no fingerprint changes.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@Prashansa-K
Prashansa-K added this pull request to the merge queue Nov 5, 2026
Merged via the queue into next with commit b8752ca Nov 5, 2026
51 of 53 checks passed
@Prashansa-K
Prashansa-K deleted the fix/serve-typed-errors branch November 5, 2026 14:01
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.

2 participants