{"record":{"id":"03f6153c68e5c146","repo":"remix-run/remix","slug":"remix-db-command-destroys-data-in-the-current","errorCode":null,"errorMessage":"`remix db ${command}` destroys data in the current app database.","messagePattern":"`remix db (.+?)` destroys data in the current app database\\.","errorType":"exception","errorClass":"UsageError","httpStatus":null,"severity":"warning","filePath":"packages/cli/src/lib/commands/db.ts","lineNumber":169,"sourceCode":"    }\n\n    let { step: rawStep, ...options } = parsed.options\n    return { command, ...options, step: parseStepOption(rawStep) }\n  }\n\n  if (command === 'reset') {\n    let parsed = parseArgs(\n      commandArgv,\n      {\n        connectionEnv: connectionOption,\n        force: { flag: '--force', type: 'boolean' },\n        journalTable: journalOption,\n        migrations: migrationsOption,\n        seed: seedOption,\n      },\n      { maxPositionals: 0 },\n    )\n    if (!parsed.options.force) throw dbForceRequired(command)\n    let { force: _, ...options } = parsed.options\n    return { command, ...options }\n  }\n\n  if (command === 'wipe') {\n    let parsed = parseArgs(\n      commandArgv,\n      {\n        connectionEnv: connectionOption,\n        force: { flag: '--force', type: 'boolean' },\n      },\n      { maxPositionals: 0 },\n    )\n    if (!parsed.options.force) throw dbForceRequired(command)\n    return { command, connectionEnv: parsed.options.connectionEnv }\n  }\n\n  if (command === 'seed') {","sourceCodeStart":151,"sourceCodeEnd":187,"githubUrl":"https://github.com/remix-run/remix/blob/9696913134be3a4423513d2775f7b31d6917c049/packages/cli/src/lib/commands/db.ts#L151-L187","documentation":"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.","triggerScenarios":"The destructive command branch of parseDbCommandArgs finds parsed.options.force falsy — running remix db reset (or the analogous destructive command) without --force.","commonSituations":"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.","solutions":["Re-run with --force: remix db reset --force (ensure the database data loss is acceptable, ideally on a dev DB)","Use migrate/wipe-appropriate non-destructive commands when you only need schema changes","Script destructive commands with the flag and guard them behind an environment check"],"exampleFix":"# before\n$ remix db reset\n\n# after\n$ remix db reset --force","handlingStrategy":"validation","validationCode":"if (isDestructiveDbCommand(cmd) && !argv.includes('--force')) {\n  throw new Error(`Refusing to run ${cmd} without --force; set FORCE_DB_RESET=1 in dev to allow`)\n}","typeGuard":"function isDestructiveDbCommand(cmd: string): boolean {\n  return ['reset', 'wipe'].includes(cmd)\n}","tryCatchPattern":"try {\n  await runDbCommand(argv, context)\n} catch (error) {\n  if (/destroys data/.test(error.message)) {\n    const ok = await confirm('This wipes the database. Continue?')\n    if (ok) return runDbCommand([...argv, '--force'], context)\n  }\n  throw error\n}","preventionTips":["Gate --force behind an env check (never in production CI)","Use migrate for schema work instead of reset when possible","Add a prompt layer in wrappers so humans confirm data-loss operations"],"tags":["cli","database","safety-confirm"],"backgroundTag":"destructive-command-confirmation","analyzedSha":"9696913134be3a4423513d2775f7b31d6917c049","analyzedAt":"2026-08-27T19:55:01.024Z","schemaVersion":2},"datasetVersion":"2026-08-28T00:17:15.603Z"}