Errors
What each CLI error code means, its exit code, and how to fix it.
Every error the CLI reports has a reason. In a terminal it prints the message
on stderr, with the commands that fix it under Next steps:. With --json
the CLI prints one error document as a single line on stderr and leaves stdout
empty. Its type links to the reason's section on this page:
{
"$schema": "https://unpkg.com/better-supabase/schemas/cli-result-v2.json",
"status": "error",
"reason": "unknown_command",
"message": "Unknown command \"genn\". Did you mean \"gen\"?",
"type": "https://bettersupabase.com/docs/cli/errors#unknown_command",
"next": [],
"data": { "suggestion": "gen" },
"userActionRequired": false,
"retryable": false
}status is action_required when a person has to give an input, confirm or
log in, and error otherwise. userActionRequired repeats that as a boolean,
and retryable is true for network_error, request_failed and
database_unreachable, where the same command can work later.
The exit code tells a script what to do next:
| Exit code | Meaning |
|---|---|
| 0 | The command succeeded. |
| 1 | The command ran and failed, or found something (--check drift, doctor errors). |
| 2 | The command, the config or the environment needs a change, or the user has to act first (give an input, confirm a change, log in); a rerun fails the same way. |
| 65 | gen --metadata rejected its GeneratorMetadata document. |
| 130 | The run was interrupted (Ctrl-C) or a prompt was cancelled. |
| 143 | The process received SIGTERM. |
On SIGINT or SIGTERM the run gets 2 seconds to clean up, then the process exits with 130 or 143. A second signal exits at once.
usage
The arguments don't fit the command in a way no more specific code covers,
such as an extra positional or a group named without a subcommand. For a
group, or no command at all under --json, choices["<command>"] lists the
subcommands. The text output adds the command's usage. Exit code 2.
unknown_command
The first argument isn't a command. When one is close enough to be a typo,
suggestion names it. Run better-supabase --help for the list. Exit
code 2.
unknown_flag
The command does not take the option. flag names it, and when a declared
option is close enough to be a typo, suggestion names that one. Run the
command with --help for its options. Exit code 2.
invalid_value
An option or environment variable has a value the CLI does not accept, such
as --format xml, --agent=maybe or a --cwd that is not a directory.
flag names the option when there is one, and the message lists the values
it takes. Exit code 2.
command_moved
The command was renamed or removed, and the CLI keeps no alias.
data.suggestion holds the new form, which you can run as is. Exit code 2.
flag_renamed
The flag was removed or renamed, and the CLI keeps no alias. data.flag
names the old flag, and data.suggestion what to use instead, such as
--yes --effects-digest <digest> for --confirm or the dev command for
gen --watch. Exit code 2.
| Removed flag | Use instead |
|---|---|
db seed --apply | --yes, which inserts the rows (--dry-run previews) |
doctor --fix | --yes, which runs the fixes against the database |
dev env --write | --out <file> |
gen --emit <file> | --only <file> with --metadata |
gen --out-dir <dir> | --out <dir> with --metadata |
missing_value
The command needs a value it didn't get, such as a connection string on
stdin for --db-url-stdin or a directory for --cwd. A stdin flag reports it at once when stdin is a
terminal instead of waiting for input. flag names the variable or option
that supplies it. Exit code 2.
outside_root
A path option points outside the project root, for example
--out ../.env.local. Run the command from the project that owns the file.
flag names the option. Exit code 2.
config_not_found
--config points at a file that doesn't exist. The path is relative to
--cwd. Exit code 2.
config_invalid
better-supabase.config.* failed to load, or has a key or value the CLI
doesn't accept. issues lists each problem as path: message, for example
gen.codecs.timestamptz: Invalid type. Exit code 2.
env_invalid
An environment variable the CLI reads has a malformed value, for example a
DATABASE_URL that isn't a URL. issues lists each variable. Exit code 2.
not_found
A file or module the command reads doesn't exist, such as a snapshot or an entry named in the config. Exit code 1.
invalid_input
A file the command reads exists but holds the wrong thing: a snapshot of an
older version, a status file without supabase status JSON, or an entry
that exports no topic or read set. Exit code 1.
dependency_missing
The command needs an optional package the project hasn't installed, such as
pg to read a database. suggestion holds the install command. Exit
code 1.
database_unreachable
The CLI couldn't connect to the database. The message has the redacted URL
and the driver's error. For a local URL that refused the connection,
suggestion is supabase start. Exit code 1.
supabase_cli_missing
The command runs the Supabase CLI and found none: not $SUPABASE_BIN, not
node_modules/.bin/supabase, and not supabase on the PATH. The CLI never
downloads one. Install it with pnpm add -D supabase. Exit code 1.
supabase_cli_failed
The Supabase CLI ran and failed, or printed output the command can't read.
Check that the local stack runs (supabase start). Exit code 1.
supabase_cli_too_old
The command needs a newer Supabase CLI than the one the project runs. The
message names the feature, the minimum version and the installed version.
config validate, stack prune and the [api.tls] settings need 3.2.0, and
dev stack prune needs 3.3.0 for --stack <id>. Update it with
pnpm add -D supabase@3.4.0. Exit code 1.
network_error
An HTTP request got no response: the host was unreachable, the connection dropped, or the request took longer than 30 seconds. The message names the host. Check the network and run the command again. Exit code 1.
request_failed
An HTTP request failed, such as a Management API query or the download of
the pinned splinter.sql. The message has the status and the start of the
response. Exit code 1.
auth_required
The command reads a hosted project and has no access token, or a request was
refused with 401 or 403. Set SUPABASE_ACCESS_TOKEN (or database.source.accessToken
in the config) to a token that can read the project. flag names the
variable when the token is missing. Exit code 2.
integrity_failed
A downloaded file didn't match its pinned hash, so the CLI refused to run it. Exit code 1.
generator_failed
A generator threw, or wrote a file outside the project root or a file that another generator writes. The message names the generator. Exit code 1.
check_failed
--check found files that are out of date. Run the command without
--check to write them. Exit code 1.
file_conflict
A file the command generates already exists without the better-supabase
header, so the app wrote it by hand. The command leaves it alone and lists it
as Skipped. Move your code elsewhere, or pass --force to overwrite it. Exit
code 1.
findings
A check such as doctor or spec validate found problems at or above the
--fail-on level. The report lists them. Exit code 1.
input_required
The command needs an answer it would prompt for, and it can't prompt (in CI,
under --json or for an agent), or a required positional such as
blocks view <block> is missing. missing lists the flags and positionals
it needs, choices the values each one takes when there is a fixed set, and next
holds the command to run with the answer filled in. Exit code 2. See
agent mode.
confirmation_required
The command would make a destructive change, and needs the user's explicit
confirmation. Agent mode asks for it before --force overwrites files the CLI
didn't write and before db seed --yes writes to a database that isn't on
this machine. data.effects lists what would change. Rerun the command with
--yes --effects-digest <digest>, the command that next shows (the digest is
also in data.digest, and covers only that command line); --yes alone
doesn't confirm it. Exit code 2. See agent mode.
cancelled
The person cancelled a prompt with Ctrl-C or Escape. Nothing after the prompt ran. Exit code 130.
failed
The command ran and reported a failure. exitCode is the command's own exit
code, usually 1.
internal
Something the CLI didn't expect went wrong. message has the underlying
message. Exit code 1. If it looks like a bug,
open an issue with
the command and the message.
Codes from other CLIs
The exit codes, the result and error documents and the reason names on this
page are a contract other CLIs can share. A CLI that adopts it keeps each
reason's name, title and exit code, and adds reasons of its own only under new
names, such as dirty_worktree (exit 2) for a rewrite that finds uncommitted
changes, or
write_failed (exit 1). better-supabase never reuses one of those names for
another meaning, so a script can match a code without knowing which CLI
printed it.
Last updated on