{"record":{"id":"2cd23769d79d594c","repo":"vuejs/vue-router","slug":"e-message","errorCode":null,"errorMessage":"${e.message}","messagePattern":"\\$\\{e\\.message\\}","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"src/util/query.js","lineNumber":38,"sourceCode":"  } catch (err) {\n    if (process.env.NODE_ENV !== 'production') {\n      warn(false, `Error decoding \"${str}\". Leaving it intact.`)\n    }\n  }\n  return str\n}\n\nexport function resolveQuery (\n  query: ?string,\n  extraQuery: Dictionary<string> = {},\n  _parseQuery: ?Function\n): Dictionary<string> {\n  const parse = _parseQuery || parseQuery\n  let parsedQuery\n  try {\n    parsedQuery = parse(query || '')\n  } catch (e) {\n    process.env.NODE_ENV !== 'production' && warn(false, e.message)\n    parsedQuery = {}\n  }\n  for (const key in extraQuery) {\n    const value = extraQuery[key]\n    parsedQuery[key] = Array.isArray(value)\n      ? value.map(castQueryParamValue)\n      : castQueryParamValue(value)\n  }\n  return parsedQuery\n}\n\nconst castQueryParamValue = value => (value == null || typeof value === 'object' ? value : String(value))\n\nfunction parseQuery (query: string): Dictionary<string> {\n  const res = {}\n\n  query = query.trim().replace(/^(\\?|#|&)/, '')\n","sourceCodeStart":20,"sourceCodeEnd":56,"githubUrl":"https://github.com/vuejs/vue-router/blob/680ccc68c506cca9be6207745043245d61fa715a/src/util/query.js#L20-L56","documentation":"resolveQuery delegates to parseQuery (default or a custom _parseQuery) inside a try/catch. If the parser throws on the raw query string, the error's message is surfaced via this warning and an empty parsed query ({}) is used so navigation can proceed. This is a dev-mode safety net around malformed query strings or a broken custom parser.","triggerScenarios":"Parsing a query string that makes parseQuery throw — in the default parser this typically happens when decode throws on invalid percent-encoding that propagates (custom parsers may throw for any reason), or supplying a faulty _parseQuery implementation to routes/resolveQuery that raises on edge-case input.","commonSituations":"Custom parseQuery replacements (used for query param serialization customization) that throw on unusual input like 'a=%' or keys without '='; malformed URLs from external sources; library upgrades where a custom parser's assumptions no longer hold.","solutions":["Fix the malformed query string at the source (properly URL-encode values with encodeURIComponent / URLSearchParams).","Make the custom _parseQuery never throw: wrap its internals in try/catch and return a partial/partial object instead.","Validate/sanitize location.query strings before passing them to router.push/resolve.","Upgrade vue-router if the throwing parser was a known fixed bug; otherwise add an integration test for the offending input."],"exampleFix":"// before\nfunction _parseQuery (query) { return strictParse(query) } // may throw\n// after\nfunction _parseQuery (query) {\n  try { return strictParse(query) } catch (e) { return {} }\n}","handlingStrategy":"try-catch","validationCode":"function safeQuery (raw) {\n  try { return new URLSearchParams(raw.startsWith('?') ? raw.slice(1) : raw).toString() } catch (e) { return '' }\n}","typeGuard":null,"tryCatchPattern":"try {\n  await router.push({ path: '/x', query: parsedQuery })\n} catch (e) {\n  console.warn('query parsing failed:', e.message)\n  await router.push({ path: '/x' })\n}","preventionTips":["If supplying a custom parseQuery, make it throw-proof: wrap parsing in try/catch and return a partial object.","Test your custom parser against edge inputs: 'a=%', '=v', 'a', '&', '%E0%A4'.","Use URLSearchParams as a robust baseline parser instead of hand-rolled splitting.","Keep the parser signature/behavior aligned with the vue-router version in use."],"tags":["vue-router","query-string","custom-parser","parse-error"],"backgroundTag":"query-string-parse-failed","analyzedSha":"680ccc68c506cca9be6207745043245d61fa715a","analyzedAt":"2026-09-02T19:19:01.204Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-10T02:17:09.455Z"}