{"record":{"id":"bf2486d1806df94e","repo":"vercel/next.js","slug":"failed-to-decode-param","errorCode":null,"errorMessage":"failed to decode param","messagePattern":"failed to decode param","errorType":"http","errorClass":"DecodeError","httpStatus":400,"severity":"error","filePath":"packages/next/src/shared/lib/router/utils/route-matcher.ts","lineNumber":29,"sourceCode":"  // We only use the exec method of the RegExp object. This helps us avoid using\n  // type assertions that the passed in properties are of the correct type.\n  re: Pick<RegExp, 'exec'>\n  groups: Record<string, Group>\n}\n\nexport function getRouteMatcher({\n  re,\n  groups,\n}: RouteMatcherOptions): RouteMatchFn {\n  const rawMatcher = (pathname: string) => {\n    const routeMatch = re.exec(pathname)\n    if (!routeMatch) return false\n\n    const decode = (param: string) => {\n      try {\n        return decodeURIComponent(param)\n      } catch {\n        throw new DecodeError('failed to decode param')\n      }\n    }\n\n    const params: Params = {}\n    for (const [key, group] of Object.entries(groups)) {\n      const match = routeMatch[group.pos]\n      if (match !== undefined) {\n        if (group.repeat) {\n          params[key] = match.split('/').map((entry) => decode(entry))\n        } else {\n          params[key] = decode(match)\n        }\n      }\n    }\n\n    return params\n  }\n","sourceCodeStart":11,"sourceCodeEnd":47,"githubUrl":"https://github.com/vercel/next.js/blob/0eb377541648e63402a47b38fee00a8d0ce8f8f1/packages/next/src/shared/lib/router/utils/route-matcher.ts#L11-L47","documentation":"getRouteMatcher's internal decode helper wraps decodeURIComponent for each matched dynamic parameter; when a captured URL segment contains a malformed percent-encoding (e.g. a truncated escape like '%E0%A4' or a stray '%'), decodeURIComponent throws and this DecodeError is raised instead of returning params, aborting route matching.","triggerScenarios":"Decoding a route parameter fails.","commonSituations":"A URL segment contains malformed percent-encoding that decodeURIComponent rejects.","solutions":["Ensure dynamic route params are valid URI-encoded values."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"0eb377541648e63402a47b38fee00a8d0ce8f8f1","analyzedAt":"2026-08-19T02:10:13.922Z","contentChangedAt":"2026-08-19T02:10:13.922Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}