Skip to content

[BUG]: drizzle-kit migrate CLI silently fails with exit code 1 - SQL errors not printed #5521

@isaced

Description

@isaced

What version of drizzle-orm are you using?

0.45.1

What version of drizzle-kit are you using?

0.31.10

Describe the Bug

When running drizzle-kit migrate (CLI), if a SQL migration statement fails, the command exits with exit code 1 but does not print the actual PostgreSQL error. Only NOTICE messages from earlier statements are shown, leaving the user with no indication of what went wrong.

Steps to Reproduce

  1. Define a schema with a vector(4096) column and an HNSW index:
import { pgTable, uuid, text, vector, index } from "drizzle-orm/pg-core";

export const notes = pgTable(
  'notes',
  {
    id: uuid('id').primaryKey().defaultRandom(),
    content: text('content').notNull(),
    embedding: vector('embedding', { dimensions: 4096 }),
  },
  (table) => [
    index('embeddingIndex').using('hnsw', table.embedding.op('vector_cosine_ops')),
  ]
);
  1. Run npx drizzle-kit migrate

Actual Behavior

applying migrations...{ severity_local: 'NOTICE', code: '42P06', message: 'schema "drizzle" already exists, skipping' }
applying migrations...{ severity_local: 'NOTICE', code: '42P07', message: 'relation "__drizzle_migrations" already exists, skipping' }

Command exited with code 1

The real PostgreSQL error is completely hidden. No error message, no stack trace — just a silent failure.

Expected Behavior

The actual SQL error should be printed to the console. When manually executing the same SQL statements against the database, the real error is revealed:

ERROR: column cannot have more than 2000 dimensions for hnsw index

This is because pgvector's HNSW index supports a maximum of 2000 dimensions for the vector type, but the migration attempts to create an index on a vector(4096) column. The user has no way to know this from the CLI output alone.

The CLI should always surface the underlying database error so users can diagnose and fix their schema.

Workaround

Manually execute the migration SQL statements directly against the database to reveal the actual error. The root cause in this specific case is the pgvector HNSW 2000-dimension limit, but the silent failure is a drizzle-kit bug regardless of the underlying SQL error.

Environment

  • Database: PostgreSQL + pgvector (Supabase)
  • OS: macOS
  • drizzle-orm: 0.45.1
  • drizzle-kit: 0.31.10
  • Runtime: Bun

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions