Skip to content

Troubleshooting

The errors people actually hit, in the order they usually hit them. If your problem isn’t here, see Getting help at the bottom.

npm install -g @sqlanvil/cli fails with EACCES / permission errors — your global npm prefix needs root. Either run without installing (npx @sqlanvil/cli compile .) or change npm’s default directory.

sqlanvil: command not found after install — the npm global bin directory isn’t on your PATH. npm bin -g shows where it is.

Node version errors — SQLAnvil needs Node 20.19+ or 22.12+. Check with node --version. On an older Node, every command fails at startup with ERR_REQUIRE_ESM (since 1.32.9).

ENOTFOUND db.<project-ref>.supabase.co — the classic Supabase one. The direct db.<ref> host is IPv6-only; most networks can’t reach it. Use the Session pooler instead: in the Supabase dashboard’s Connect dialog, copy the pooler host verbatim — aws-N-<region>.pooler.supabase.com, port 5432, user postgres.<project-ref> (the ref suffix on the user is required through the pooler).

Authentication failed (Postgres/Supabase) — check the user: through the Session pooler it’s postgres.<project-ref>, not plain postgres. And sslMode should be "require" for any managed database.

.df-credentials.json seems ignored or “invalid” — SQLAnvil uses a flat shape (host/port/database/user/password/sslMode), not Dataform’s nested one. Warehouse examples: Getting Started. Two shape gotchas: BigQuery uses projectId + location (auth via gcloud auth application-default login, or add a "credentials" field with a service-account key); MySQL has no defaultSchema — the defaultDataset in workflow_settings.yaml is the database.

Credentials file committed by accident? init writes it gitignored — if you moved or recreated it, re-add it to .gitignore and rotate the password.

Three verbs, three different failure classes:

  • sqlanvil compile . needs no database at all. If compile fails, the problem is in your project code: an unresolved ${ref("...")} (no action with that name — check the target schema/name, not just the filename), a config error, or a JS error in includes/.
  • sqlanvil run . needs credentials and real tables. The sample project from init compiles immediately but won’t run until the app_orders declaration points at a table that exists (and the BigQuery source has credentials — or delete that pair).
  • sqlanvil validate . is the “what’s still missing” check — it verifies every action against the warehouse (EXPLAIN-based on Postgres/Supabase, dry-run on BigQuery) without writing anything, and names exactly what’s broken. When in doubt, run validate first.
  • Statements in an action body are separated with --- on its own line — not ;.
  • The settings key is sqlanvilCoreVersion, not dataformCoreVersion (the migrator converts this for you). From 1.39.0 it must be an exact version such as 1.39.0: a range (^1.39.0), a tag or a URL fails with Invalid sqlanvilCoreVersion … must be a valid semantic version.
  • Action targets must have a dataset (schema) (1.39.0+) — the action has no schema to write to. Set defaultDataset in workflow_settings.yaml (init writes it), or schema: in the action’s config. Operations without hasOutput: true don’t need one.
  • 'schema' is a legacy alias for 'dataset'; cannot specify both at the same time (1.41.0+) — the config sets both names of one field. Keep one: schema or dataset, database or project, dependencies or dependencyTargets, fileName or filename.
  • Warehouse-specific config lives in postgres: {} / mysql: {} / bigquery: {} blocks — don’t hand-roll DDL for indexes or partitions in SQL.
  • Each warehouse guide ends with its own error table — see MySQL in particular.

A pinned compile can’t find a gitignored file

Section titled “A pinned compile can’t find a gitignored file”

When workflow_settings.yaml sets sqlanvilCoreVersion, compile copies the project to a temporary directory, installs that core version there, and compiles the copy. Since 1.37.3 the copy skips what the project-root .gitignore excludes, so a .venv or build directory does not slow the compile. These are always copied, whatever the ignore files say:

  • definitions/ and includes/, and anything they reach through symbolic links inside the project
  • workflow_settings.yaml and .npmrc

.git and node_modules are never copied.

Anything else that is gitignored is missing from the copy. Examples are SQL that actions.yaml points at outside definitions/, a helper that a definition require()s from a gitignored directory, or a CA file that .npmrc names. The compile then fails with Cannot find module …, and prints a note naming the excluded path:

Note: 'queries' is in the project but not in the copy compiled for sqlanvilCoreVersion, because
.gitignore or .sqlanvilignore excludes it. If module 'queries/example.sql' is there, re-include
it in .sqlanvilignore.

To bring the path back without changing what git ignores, add a .sqlanvilignore to the project root. It uses .gitignore syntax and is read after the .gitignore:

.sqlanvilignore
!/queries/

As in git, a file can’t be re-included while its parent directory is still excluded. Re-include the directory. Only the ignore files in the project root are read; nested .gitignore files are not. Projects that don’t pin sqlanvilCoreVersion (they use a package.json) compile in place, and none of this applies to them.

Opened a PR, no CI check appeared — the SQLAnvil GitHub App isn’t installed on that repository, or the repo isn’t connected to the project. Both steps: Connect a repo.

Branch CI fails immediately on Supabase — branch CI creates an ephemeral Supabase branch, which requires the warehouse project to be on the Pro plan. See Connect Supabase.

Supabase connection stopped working after an update — OAuth scopes are granted per-authorization; if the app’s scopes changed you need to disconnect and reconnect once.

Debugging a failed run — the run page shows each action’s executed SQL and the verbatim warehouse error; Copy failure context bundles it for pasting into a coding agent. If your agent is connected over MCP, get_run_failure fetches the same bundle directly.

SQLAnvil is deliberately self-service — there’s no ticket queue, and these docs are the support system. When they’re not enough:

Found a fix that belongs on this page? Docs PRs are welcome — every page has an “Edit page” link.