{"record":{"id":"e44779c4a538700f","repo":"remix-run/remix","slug":"unknown-command-db-command","errorCode":null,"errorMessage":"Unknown command: db ${command}","messagePattern":"Unknown command: db (.+?)","errorType":"exception","errorClass":"UsageError","httpStatus":null,"severity":"error","filePath":"packages/cli/src/lib/commands/db.ts","lineNumber":118,"sourceCode":"      ],\n      usage: [\n        'remix db wipe --force [options]',\n        'remix db migrate [--to <migration>] [options]',\n        'remix db rollback [--step <count> | --to <migration>] [--dry-run] [options]',\n        'remix db status [options]',\n        'remix db seed [options]',\n        'remix db reset --force [options]',\n      ],\n    },\n    target,\n  )\n}\n\nfunction parseDbCommandArgs(argv: string[]): DatabaseCommandInvocation {\n  let [command, ...commandArgv] = argv\n\n  if (!isDatabaseCommand(command)) {\n    throw unknownCommand(`db ${command}`)\n  }\n\n  if (command === 'migrate') {\n    let parsed = parseArgs(\n      commandArgv,\n      {\n        connectionEnv: connectionOption,\n        journalTable: journalOption,\n        migrations: migrationsOption,\n        to: { flag: '--to', type: 'string' },\n      },\n      { maxPositionals: 0 },\n    )\n    return { command, ...parsed.options }\n  }\n\n  if (command === 'rollback') {\n    let parsed = parseArgs(","sourceCodeStart":100,"sourceCodeEnd":136,"githubUrl":"https://github.com/remix-run/remix/blob/9696913134be3a4423513d2775f7b31d6917c049/packages/cli/src/lib/commands/db.ts#L100-L136","documentation":"The db subcommand dispatcher validates the first positional against the known database commands (migrate, and the destructive ones guarded later) and throws when it does not match any of them.","triggerScenarios":"parseDbCommandArgs sees a command word outside the accepted set, e.g. remix db studio, remix db push, or a typo like remix db migrade.","commonSituations":"Porting habits from other ORM CLIs (drizzle, prisma) that offer studio/push/generate; typos; CLI versions where a subcommand was renamed or not yet released.","solutions":["Run remix db --help to list supported subcommands in your version","Use the correct subcommand (typically remix db migrate)","Update @remix-run/cli if docs reference a subcommand your version lacks"],"exampleFix":"# before\n$ remix db push\n\n# after\n$ remix db migrate","handlingStrategy":"type-guard","validationCode":"const DB_COMMANDS = new Set(['migrate', 'reset', 'wipe']) // mirror isDatabaseCommand\n\nfunction isKnownDbCommand(cmd?: string): boolean {\n  return cmd != null && DB_COMMANDS.has(cmd)\n}","typeGuard":"function isDatabaseCommand(cmd: string): cmd is 'migrate' | 'reset' | 'wipe' {\n  return ['migrate', 'reset', 'wipe'].includes(cmd)\n}","tryCatchPattern":"try {\n  runDbCommand(argv, context)\n} catch (error) {\n  if (/Unknown command: db/.test(error.message)) printDbHelp()\n  else throw error\n}","preventionTips":["Run remix db --help rather than assuming parity with other ORM CLIs","Pin the CLI version your scripts were written against","Wrap db commands in package.json scripts validated at author time"],"tags":["cli","database","arguments"],"backgroundTag":"unknown-cli-subcommand","analyzedSha":"9696913134be3a4423513d2775f7b31d6917c049","analyzedAt":"2026-08-27T19:55:01.024Z","schemaVersion":2},"datasetVersion":"2026-08-28T00:17:15.603Z"}