remix-run/remix · error · TypeError
hmr must be provided
Error message
hmr must be provided
What it means
`--verbose` adds extra decoration to the human-readable routes output and is incompatible with `--json`, which must stay machine-parseable. The parser rejects the pair at parse time.
Source
Thrown at packages/assets/src/lib/asset-server.ts:922
let hmrBase = `${basePath}/__remix_hmr`
return {
client: `${hmrBase}/client.js`,
events: `${hmrBase}/events`,
}
}
function createHmrClientResponse(eventPathname: string, method: string): Response {
return new Response(method === 'HEAD' ? null : createHmrClientSource({ eventPathname }), {
headers: {
'Cache-Control': 'no-cache',
'Content-Type': 'application/javascript; charset=utf-8',
},
})
}
function assertBrowserEventUrl(url: string | undefined): asserts url is string {
if (url === undefined) {
throw new TypeError('hmr must be provided')
}
}
function createHmrPayloadSender(): (payload: HmrPayload) => void {
return () => {}
}
function createBrowserHmrEvent(
payload: Extract<HmrPayload, { type: 'browser:reload' | 'browser:update' }>,
files: readonly string[],
): BrowserHmrEvent {
if (payload.type === 'browser:reload') {
return {
...(files.length === 0 ? {} : { files: [...files] }),
type: 'reload',
}
}
View on GitHub (pinned to 9696913134)
Solutions
- Drop `--verbose` when using `--json`
- If you need more data in JSON, the JSON output already includes full route info — parse it directly
- Remove stale flags from shared scripts
Example fix
# before remix routes --json --verbose # after remix routes --json
Defensive patterns
Strategy: validation
Validate before calling
let args = ['remix','routes'];
if (json) args.push('--json');
else if (verbose) args.push('--verbose'); // mutually exclusive by construction Type guard
function isValidRoutesFlags(f: { json?: boolean; verbose?: boolean }): boolean {
return !(f.json && f.verbose);
} Prevention
- Treat --json as machine mode; skip human-oriented flags
- Audit accumulated script flags
When it happens
Trigger: Running `remix routes --json --verbose` — both flags truthy in `parseRoutesCommandArgs`.
Common situations: Scripts that used `--verbose` and later gained `--json`; wanting extra detail in JSON output and assuming verbose applies.
Related errors
- hmr requires watch mode
- Missing app/routes.ts path.
- Route module ${routesFile} must export a named "routes" valu
- RMX_ROUTE_MAP_LOADER_FAILED
- RMX_ROUTE_MAP_LOADER_INVALID_JSON
AI-assisted analysis of remix-run/remix@9696913134 (2026-08-27).
Data as JSON: /api/errors/9331af00d7200c4c.
Report an issue: GitHub.