{"record":{"id":"ddf744e633be959f","repo":"vuejs/vue-router","slug":"vue-router-message","errorCode":null,"errorMessage":"[vue-router] ${message}","messagePattern":"\\[vue-router\\] (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"warning","filePath":"src/util/warn.js","lineNumber":5,"sourceCode":"/* @flow */\n\nexport function assert (condition: any, message: string) {\n  if (!condition) {\n    throw new Error(`[vue-router] ${message}`)\n  }\n}\n\nexport function warn (condition: any, message: string) {\n  if (!condition) {\n    typeof console !== 'undefined' && console.warn(`[vue-router] ${message}`)\n  }\n}\n\n","sourceCodeStart":1,"sourceCodeEnd":15,"githubUrl":"https://github.com/vuejs/vue-router/blob/680ccc68c506cca9be6207745043245d61fa715a/src/util/warn.js#L1-L15","documentation":"This is the dev-only warning (console.warn, not a throw) emitted from abort() in the history base class when an error occurs during route navigation and no onError handler is registered. It tells you a navigation guard or async component rejected and the error was 'uncaught' from the router's perspective. The original error is printed immediately after via console.error(err).","triggerScenarios":"next(err)/abort(err) is called during navigation — e.g. a beforeEach guard calls next(new Error(...)), an async route component fails to load, or a promise in a guard rejects — while router.onError() was never called.","commonSituations":"Chunk load failures (ChunkLoadError) after a deploy invalidates old JS chunks; guards throwing inside async code; redirect loops or errors in navigation guards on production builds that only show up in the console.","solutions":["Register router.onError(handler) to catch and handle/log navigation errors explicitly.","Check the console.error output below the warning for the real error (often a chunk load error or guard exception).","Handle chunk-load failures by detecting them in onError and reloading the page: if (/Chunk|Loading.+failed/.test(err.message)) window.location.reload().","Fix the underlying guard/async-component code that produced the error."],"exampleFix":"// before\nconst router = new VueRouter({ routes })\n// after\nconst router = new VueRouter({ routes })\nrouter.onError(err => {\n  console.error('navigation failed:', err)\n  if (/Loading chunk \\d+ failed/.test(err.message)) window.location.reload()\n})","handlingStrategy":"try-catch","validationCode":"// validate router options before constructing\nfunction validRouterOptions (opts) {\n  return opts && typeof opts === 'object' &&\n    ['hash', 'history', 'abstract'].includes(opts.mode || 'hash') &&\n    Array.isArray(opts.routes)\n}","typeGuard":"function isRouterOptions (o) {\n  return !!o && typeof o === 'object' && typeof o.routes === 'undefined' || Array.isArray(o && o.routes)\n}","tryCatchPattern":"try {\n  const router = new VueRouter(options)\n} catch (e) {\n  if (e.message.startsWith('[vue-router]')) {\n    console.error('Invalid router configuration:', e.message)\n    // fall back to safe defaults\n  } else throw e\n}","preventionTips":["Double-check mode spelling and environment support (history mode needs pushState).","Validate routes/options shape before constructing the router.","Keep vue-router at a maintained 3.x version and read its changelog before upgrades.","Never call private router internals from application code."],"tags":["vue-router","navigation-guards","unhandled-error","async"],"backgroundTag":"uncaught-error-during-navigation","analyzedSha":"680ccc68c506cca9be6207745043245d61fa715a","analyzedAt":"2026-09-02T19:19:01.204Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-10T02:17:09.455Z"}