Cursor cant deal with drizzle db:generate?

Where does the bug appear (feature/product)?

Background Agent (GitHub, Slack, Web, Linear)

Describe the Bug

I’m experiencing an issue where the agent is not able to properly interact with Drizzle CLI in interactive mode. It seems the agent cannot handle drizzle-kit generate (or likely any other TTY-based command).

I asked the Cursor web agent (https://cursor.com/agents/…) the following:

Was this SQL file created via drizzle-kit generate?

The agent replied:


No. 0024_class_schema_refactoring.sql was not created by bun drizzle-kit generate. It was written manually.
Reason: drizzle-kit generate runs Drizzle Kit in interactive mode and waits for input, for example:

# drizzle-kit interactive prompt
Is classes table created or renamed from another table?
> classes create table
  user_classes > classes rename table

Because that prompt can’t be answered automatically, the migration was hand-written using:

  • The new classes and class_members schemas
  • The PRD and plan docs
  • The existing user_classes schema and migrations 0018 and 0020

I tested the same scenario with Claude. Initially, the response was similar. After I insisted, it answered:

The interactive TTY can’t be piped. Let me use --custom, which creates a blank file and properly updates the journal/snapshot, then I’ll fill in the SQL.

Both agents ended up using --custom to generate the migration file. However, the generated migration is not executed when running:

drizzle-kit migrate

It seems that:

  • The agent cannot properly interact with TTY-based CLI prompts.
  • The workaround using --custom produces a migration file that is not picked up or executed as expected, could be a drizzle’s bug…
  • There may be an issue with how agents simulate or handle interactive CLI flows.

Has anyone experienced similar behavior with TTY-based tools in Cursor agents?
Is there a recommended way to handle interactive CLIs like drizzle-kit generate within the agent environment?

Steps to Reproduce

  1. Create a 1:N schema (UserUserAddress) and run drizzle-kit generate + migrate.
  2. Refactor it to N:N (UserAddress via UserAddress join table).
  3. Ask the agent to generate the new migration.
  4. The agent cannot handle the interactive TTY and falls back to --custom.
  5. Run drizzle-kit migrate and observe the migration is not executed.

Expected Behavior

  • The agent should be able to handle interactive CLI tools like drizzle-kit generate, either by properly interacting with the TTY prompt or by using a fully supported non-interactive alternative.

  • If --custom is used as a fallback, the generated migration must:

    • Be correctly registered in Drizzle’s journal/snapshot.
    • Be detected by drizzle-kit migrate.
    • Be executed normally when running:
    drizzle-kit migrate
    
    
    
    

Operating System

MacOS

Version Information

Cloud Agents

For AI issues: which model did you use?

sonnet 4.5
composer.1.5

Does this stop you from using Cursor

No - Cursor works, but with this issue

Hey, thanks for the detailed report.

This is a known limitation of Cloud Agents. The terminal runs in non-interactive mode inside an isolated VM, so it can’t handle TTY prompts that require input via stdin, like the interactive questions in drizzle-kit generate.

The agent workaround with --custom is actually heading in the right direction. For drizzle-kit, there are a few options:

  1. Use --custom correctly: drizzle-kit generate --custom creates an empty migration with the correct entry in the journal and snapshot. Then the agent should write the SQL into that file. If drizzle-kit migrate doesn’t pick it up, check that the journal (meta/_journal.json) and snapshot files are consistent. This is most likely a drizzle-kit issue, not a Cursor issue.

  2. Add a Cursor rule: You can create a .cursor/rules file in the project with instructions like:

    When generating Drizzle migrations, never use interactive `drizzle-kit generate`.
    Instead, use `drizzle-kit generate --custom` and manually write the SQL migration content.
    Always verify that _journal.json and the snapshot are updated correctly.
    

    This way the agent knows in advance how to handle it.

  3. Non-interactive alternatives: Some CLIs have flags like --yes or --no-input. For drizzle-kit specifically, check whether newer versions support a non-interactive mode.

The second part of your issue, where the migration doesn’t run after --custom, looks more like drizzle-kit behavior. I’d suggest checking their docs or discussions about running migrations created with --custom.

Let me know if the Cursor Rule approach helps.

1 Like

Hi Dean Rie,

Thanks for your reply.

Unfortunately, that’s more or less the explanation I expected.

Just out of curiosity, I couldn’t find any documentation about this. Did I overlook something?

Best regards,

Good catch, this isn’t explicitly documented right now. The docs mention that Cloud Agents run in isolated VMs, but they don’t specifically call out the non-interactive terminal limitation.

I’ve flagged this as a docs gap on our side. Thanks.

1 Like