remix-run/remix · critical · AssertionError

throw new AssertionError(options)

Error message

throw new AssertionError(options)

What it means

The `remix db reset` (or wipe-equivalent) command destroys all data in the current app database, so the CLI refuses to run it unless `--force` is passed. This is a deliberate safety guard against accidental irreversible data loss. The check happens in `parseDbCommandArgs` right after flag parsing.

Source

Thrown at packages/assert/src/lib/assert.ts:79

  return message == null ? generatedMessage : message
}

function getComparisonAssertionMessage(message: unknown, generatedMessage: string): unknown {
  if (message instanceof Error) return message
  if (typeof message === 'string' && message.length > 0) return message
  return generatedMessage
}

function isGeneratedComparisonMessage(message: unknown): boolean {
  return !(message instanceof Error) && (typeof message !== 'string' || message.length === 0)
}

function throwAssertion(options: AssertionOptions, directErrorMessage = true): never {
  if (directErrorMessage && options.message instanceof Error) {
    throw options.message
  }

  throw new AssertionError(options)
}

function stringify(value: unknown): string {
  if (value === undefined) return 'undefined'
  if (typeof value === 'string') return JSON.stringify(value)
  if (typeof value === 'function') return `[Function${value.name ? ': ' + value.name : ''}]`
  if (value instanceof Error) return `${value.name}: ${value.message}`

  try {
    return JSON.stringify(value)
  } catch {
    return String(value)
  }
}

function stringifyReceived(value: unknown): string {
  if (typeof value === 'string') return `'${value}'`
  return stringify(value)

View on GitHub (pinned to 9696913134)

Solutions

  1. Add `--force` to the command: `remix db reset --force`
  2. If scripting, ensure the flag is present in the script/CI config
  3. Back up the database file before running destructive commands

Example fix

# before
remix db reset
# after
remix db reset --force
Defensive patterns

Strategy: validation

Validate before calling

let cmd = ['remix','db','reset'];
if (process.env.CI) cmd.push('--force');
spawnSync(cmd[0], cmd.slice(1), { stdio: 'inherit' })

Try / catch

Wrap the spawn/exec call; inspect stderr for 'destroys data' and require human confirmation before retrying with --force.

Prevention

When it happens

Trigger: Running `remix db reset` (any command hitting this branch) with the `--force` boolean flag absent or false, e.g. `remix db reset --connection-env DATABASE_FILE`.

Common situations: CI/CD pipelines or npm scripts that call reset without the flag; copy-pasting commands from older docs; assuming an interactive confirmation prompt appears instead of a hard failure.

Related errors


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