{"record":{"id":"a8c9cd505cb1b2ec","repo":"remix-run/remix","slug":"unknown-database-command-command","errorCode":null,"errorMessage":"Unknown database command: ' + command","messagePattern":"Unknown database command: ' \\+ command","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/data-table/src/cli.ts","lineNumber":178,"sourceCode":"      journalTable: options.journalTable,\n    })\n\n    for (let entry of entries) {\n      console.log(entry.id + ' ' + entry.name + ' ' + entry.status)\n    }\n\n    return 0\n  }\n\n  if (options.command === 'wipe') {\n    await options.db.wipe()\n    return 0\n  }\n\n  // Guard against unchecked command strings from plain-JS callers so an\n  // unknown command can never fall through to a destructive operation.\n  let command = (options as { command: string }).command\n  throw new Error('Unknown database command: ' + command)\n}\n","sourceCodeStart":160,"sourceCodeEnd":180,"githubUrl":"https://github.com/remix-run/remix/blob/9696913134be3a4423513d2775f7b31d6917c049/packages/data-table/src/cli.ts#L160-L180","documentation":"runRemixDb dispatches known database commands (migrate, rollback, status, etc.) and, at the end of dispatch, throws for any unrecognized command string. The comment in the source notes it exists so an unknown command from a plain-JS caller can never fall through to a destructive default operation.","triggerScenarios":"Calling runRemixDb({ command: 'migrat' }) with a typo; plain JavaScript callers passing arbitrary strings since TS types don't protect them; a CLI alias or script renamed across versions.","commonSituations":"Typos in npm scripts ('db:migrate' vs 'migrate'); upgrading to a version that renamed/removed a command; JS callers bypassing the discriminated-union typing.","solutions":["Check the valid command literals in the CLI types/docs and correct the spelling.","If calling from JS, mirror the TS union of command names or centralize command construction in one typed helper."],"exampleFix":"# before\nremix-db migrat\n\n# after\nremix-db migrate","handlingStrategy":"type-guard","validationCode":"const COMMANDS = ['migrate','rollback','status','create','up','wipe','reset'] as const\nif (!COMMANDS.includes(command as any)) {\n  console.error(`Unknown command. Valid: ${COMMANDS.join(', ')}`)\n  process.exit(1)\n}","typeGuard":"function isDbCommand(value: string): value is (typeof COMMANDS)[number] {\n  return COMMANDS.includes(value as any)\n}","tryCatchPattern":null,"preventionTips":["Centralize the command string in one typed constant.","Add a preflight check listing valid commands for JS callers."],"tags":["cli","unknown-command","data-table"],"backgroundTag":"unknown-cli-command","analyzedSha":"9696913134be3a4423513d2775f7b31d6917c049","analyzedAt":"2026-08-27T19:55:01.024Z","schemaVersion":2},"datasetVersion":"2026-08-28T00:17:15.603Z"}