{"record":{"id":"2bb3d44ff1e1a8f9","repo":"remix-run/remix","slug":"throw-new-assertionerror-options","errorCode":null,"errorMessage":"throw new AssertionError(options)","messagePattern":"throw new AssertionError\\(options\\)","errorType":"exception","errorClass":"AssertionError","httpStatus":null,"severity":"critical","filePath":"packages/assert/src/lib/assert.ts","lineNumber":79,"sourceCode":"  return message == null ? generatedMessage : message\n}\n\nfunction getComparisonAssertionMessage(message: unknown, generatedMessage: string): unknown {\n  if (message instanceof Error) return message\n  if (typeof message === 'string' && message.length > 0) return message\n  return generatedMessage\n}\n\nfunction isGeneratedComparisonMessage(message: unknown): boolean {\n  return !(message instanceof Error) && (typeof message !== 'string' || message.length === 0)\n}\n\nfunction throwAssertion(options: AssertionOptions, directErrorMessage = true): never {\n  if (directErrorMessage && options.message instanceof Error) {\n    throw options.message\n  }\n\n  throw new AssertionError(options)\n}\n\nfunction stringify(value: unknown): string {\n  if (value === undefined) return 'undefined'\n  if (typeof value === 'string') return JSON.stringify(value)\n  if (typeof value === 'function') return `[Function${value.name ? ': ' + value.name : ''}]`\n  if (value instanceof Error) return `${value.name}: ${value.message}`\n\n  try {\n    return JSON.stringify(value)\n  } catch {\n    return String(value)\n  }\n}\n\nfunction stringifyReceived(value: unknown): string {\n  if (typeof value === 'string') return `'${value}'`\n  return stringify(value)","sourceCodeStart":61,"sourceCodeEnd":97,"githubUrl":"https://github.com/remix-run/remix/blob/9696913134be3a4423513d2775f7b31d6917c049/packages/assert/src/lib/assert.ts#L61-L97","documentation":"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.","triggerScenarios":"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`.","commonSituations":"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.","solutions":["Add `--force` to the command: `remix db reset --force`","If scripting, ensure the flag is present in the script/CI config","Back up the database file before running destructive commands"],"exampleFix":"# before\nremix db reset\n# after\nremix db reset --force","handlingStrategy":"validation","validationCode":"let cmd = ['remix','db','reset'];\nif (process.env.CI) cmd.push('--force');\nspawnSync(cmd[0], cmd.slice(1), { stdio: 'inherit' })","typeGuard":null,"tryCatchPattern":"Wrap the spawn/exec call; inspect stderr for 'destroys data' and require human confirmation before retrying with --force.","preventionTips":["Always include --force in scripted resets","Keep database backups before destructive commands","Never assume an interactive prompt"],"tags":["cli","database","data-loss","confirmation"],"backgroundTag":"destructive-command-confirmation-required","analyzedSha":"9696913134be3a4423513d2775f7b31d6917c049","analyzedAt":"2026-08-27T19:55:01.024Z","schemaVersion":2},"datasetVersion":"2026-08-28T00:17:15.603Z"}