{"record":{"id":"93b0477cd0cc947e","repo":"remix-run/remix","slug":"cannot-combine-to-and-step-migration-options-i","errorCode":null,"errorMessage":"Cannot combine \"to\" and \"step\" migration options in the same run","messagePattern":"Cannot combine \"to\" and \"step\" migration options in the same run","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/data-table/src/cli.ts","lineNumber":109,"sourceCode":"      options.to === undefined\n        ? { journalTable: options.journalTable }\n        : { to: options.to, journalTable: options.journalTable }\n    let result = await options.db.migrate(options.migrations, migrateOptions)\n\n    if (result.applied.length === 0) {\n      console.log('no pending migrations')\n    }\n\n    for (let entry of result.applied) {\n      console.log('applied ' + entry.id + '_' + entry.name)\n    }\n\n    return 0\n  }\n\n  if (options.command === 'rollback') {\n    if (options.to !== undefined && options.step !== undefined) {\n      throw new Error('Cannot combine \"to\" and \"step\" migration options in the same run')\n    }\n\n    let result =\n      options.to === undefined\n        ? await options.db.migrate(options.migrations, {\n            direction: 'down',\n            step: options.step ?? 1,\n            dryRun: options.dryRun,\n            journalTable: options.journalTable,\n          })\n        : await options.db.migrate(options.migrations, {\n            direction: 'down',\n            to: options.to,\n            dryRun: options.dryRun,\n            journalTable: options.journalTable,\n          })\n\n    if (result.reverted.length === 0) {","sourceCodeStart":91,"sourceCodeEnd":127,"githubUrl":"https://github.com/remix-run/remix/blob/9696913134be3a4423513d2775f7b31d6917c049/packages/data-table/src/cli.ts#L91-L127","documentation":"The remix-db CLI rollback command accepts either --to <target> (roll back to a specific migration) or --step <n> (roll back n steps), but not both. runRemixDb rejects the combination before touching the database because the two options imply conflicting rollback endpoints.","triggerScenarios":"Running `remix-db rollback --to 0003 --step 2` or constructing options with both `to` and `step` set for the rollback command programmatically.","commonSituations":"Copy-pasting a previous rollback command and appending flags; CI scripts that pass both options defensively; misunderstanding that `to` is an absolute target while `step` is relative.","solutions":["Choose one: use `--to <migration-id>` for an absolute target or `--step <n>` for a relative count.","For 'roll back everything', prefer `--to 0` or the reset command rather than combining options."],"exampleFix":"# before\nremix-db rollback --to 0003 --step 2\n\n# after\nremix-db rollback --step 2","handlingStrategy":"validation","validationCode":"if (options.to !== undefined && options.step !== undefined) {\n  throw new Error('Pass either --to or --step, not both')\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Standardize rollback scripts on --step for relative rollbacks.","Document one canonical rollback command per team runbook."],"tags":["cli","migrations","rollback","option-conflict"],"backgroundTag":"conflicting-cli-options","analyzedSha":"9696913134be3a4423513d2775f7b31d6917c049","analyzedAt":"2026-08-27T19:55:01.024Z","schemaVersion":2},"datasetVersion":"2026-08-28T00:17:15.603Z"}