remix-run/remix · warning · UsageError

`remix db ${command}` destroys data in the current app datab

Error message

`remix db ${command}` destroys data in the current app database.

What it means

Destructive database subcommands (reset and similar) require an explicit --force to acknowledge data loss. When the flag is absent, parsing aborts with this confirmation-style error before any connection is made.

Source

Thrown at packages/cli/src/lib/commands/db.ts:169

    }

    let { step: rawStep, ...options } = parsed.options
    return { command, ...options, step: parseStepOption(rawStep) }
  }

  if (command === 'reset') {
    let parsed = parseArgs(
      commandArgv,
      {
        connectionEnv: connectionOption,
        force: { flag: '--force', type: 'boolean' },
        journalTable: journalOption,
        migrations: migrationsOption,
        seed: seedOption,
      },
      { maxPositionals: 0 },
    )
    if (!parsed.options.force) throw dbForceRequired(command)
    let { force: _, ...options } = parsed.options
    return { command, ...options }
  }

  if (command === 'wipe') {
    let parsed = parseArgs(
      commandArgv,
      {
        connectionEnv: connectionOption,
        force: { flag: '--force', type: 'boolean' },
      },
      { maxPositionals: 0 },
    )
    if (!parsed.options.force) throw dbForceRequired(command)
    return { command, connectionEnv: parsed.options.connectionEnv }
  }

  if (command === 'seed') {

View on GitHub (pinned to 9696913134)

Solutions

  1. Re-run with --force: remix db reset --force (ensure the database data loss is acceptable, ideally on a dev DB)
  2. Use migrate/wipe-appropriate non-destructive commands when you only need schema changes
  3. Script destructive commands with the flag and guard them behind an environment check

Example fix

# before
$ remix db reset

# after
$ remix db reset --force
Defensive patterns

Strategy: validation

Validate before calling

if (isDestructiveDbCommand(cmd) && !argv.includes('--force')) {
  throw new Error(`Refusing to run ${cmd} without --force; set FORCE_DB_RESET=1 in dev to allow`)
}

Type guard

function isDestructiveDbCommand(cmd: string): boolean {
  return ['reset', 'wipe'].includes(cmd)
}

Try / catch

try {
  await runDbCommand(argv, context)
} catch (error) {
  if (/destroys data/.test(error.message)) {
    const ok = await confirm('This wipes the database. Continue?')
    if (ok) return runDbCommand([...argv, '--force'], context)
  }
  throw error
}

Prevention

When it happens

Trigger: The destructive command branch of parseDbCommandArgs finds parsed.options.force falsy — running remix db reset (or the analogous destructive command) without --force.

Common situations: First-time users running reset without knowing about the guard; CI scripts authored before the flag was introduced; local dev where users expect a y/N prompt instead of a flag.

Related errors


AI-assisted analysis of remix-run/remix@9696913134 (2026-08-27). Data as JSON: /api/errors/03f6153c68e5c146. Report an issue: GitHub.