cli icon indicating copy to clipboard operation
cli copied to clipboard

GitHub Issue: Supabase CLI `db pull` Failure During Schema Diff

Open khalilkhasseb2025 opened this issue 2 months ago • 0 comments

📝 GitHub Issue: Supabase CLI db pull Failure During Schema Diff

Title: supabase db pull fails with error diffing schema: error running container: exit 1

Description

When attempting to pull the remote database schema using supabase db pull --debug, the command consistently fails during the "Diffing schemas" step with the error error diffing schema: error running container: exit 1.

The full debug output suggests the failure occurs within the container running the schema diffing tool (likely based on Deno/TypeScript and @pgkit/migra dependencies).

This issue prevents local development environments from synchronizing with the latest remote schema changes.

🐛 Error Logs

Diffing schemas...
...
2025/12/12 14:13:38 PG Send: {"Type":"Terminate"}
error diffing schema: error running container: exit 1: 
DEBUG No .npmrc file found 
DEBUG Finished config loading. 
... (Deno/NPM dependency resolution logs follow)

🔁 Reproduction Steps

  1. Ensure local project is configured and linked to the remote project (supabase link).
  2. Run the pull command:
    supabase db pull
    # or with debug:
    supabase db pull --debug
    
  3. Observe the command stall and fail at the "Diffing schemas" stage.

💡 Suggested Diagnosis / Possible Causes

The exit 1 in the schema diff container often indicates a failure to parse the remote SQL schema. Possible causes include:

  1. Invalid SQL Syntax in Remote Database: A complex function, trigger, or view definition in the remote Supabase database's schema contains syntax or semantic errors that the schema inspection tool cannot process.
  2. Resource Constraints: The Docker container used for the shadow database or diffing may be running out of resources (memory/CPU) on the host machine, causing a crash.
  3. Tooling/Dependency Issue: An incompatibility or bug within the specific version of the CLI (2.65.5) or its internal dependencies (@pgkit/migra, Deno runtime).

🏷️ Metadata

  • Supabase CLI Version: 2.65.5
  • **Operating System:**MacOs Sequoia
  • Remote Database PostgreSQL Version: 15.8 (Based on logs)
  • Connection Pooler Used: Yes (AWS, as per logs)
  • Are you using self-hosted Realtime? Yes, it seems so based on the log: Seeding selfhosted Realtime

khalilkhasseb2025 avatar Dec 12 '25 15:12 khalilkhasseb2025