remix-run/remix · error · Error
Unknown database command: ' + command
Error message
Unknown database command: ' + command
What it means
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.
Source
Thrown at packages/data-table/src/cli.ts:178
journalTable: options.journalTable,
})
for (let entry of entries) {
console.log(entry.id + ' ' + entry.name + ' ' + entry.status)
}
return 0
}
if (options.command === 'wipe') {
await options.db.wipe()
return 0
}
// Guard against unchecked command strings from plain-JS callers so an
// unknown command can never fall through to a destructive operation.
let command = (options as { command: string }).command
throw new Error('Unknown database command: ' + command)
}
View on GitHub (pinned to 9696913134)
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.
Example fix
# before remix-db migrat # after remix-db migrate
Defensive patterns
Strategy: type-guard
Validate before calling
const COMMANDS = ['migrate','rollback','status','create','up','wipe','reset'] as const
if (!COMMANDS.includes(command as any)) {
console.error(`Unknown command. Valid: ${COMMANDS.join(', ')}`)
process.exit(1)
} Type guard
function isDbCommand(value: string): value is (typeof COMMANDS)[number] {
return COMMANDS.includes(value as any)
} Prevention
- Centralize the command string in one typed constant.
- Add a preflight check listing valid commands for JS callers.
When it happens
Trigger: 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.
Common situations: Typos in npm scripts ('db:migrate' vs 'migrate'); upgrading to a version that renamed/removed a command; JS callers bypassing the discriminated-union typing.
Related errors
- Could not resolve allowed package "${packageName}".
- Could not resolve dependency "${dependencyName}" from ${pack
- throw new AssertionError(options)
- ${matcherName} requires a mock function with a .mock.calls p
- throw new AssertionError({ message, actual, expected, operat
AI-assisted analysis of remix-run/remix@9696913134 (2026-08-27).
Data as JSON: /api/errors/a8c9cd505cb1b2ec.
Report an issue: GitHub.