{"record":{"id":"a77d075ea662ba4e","repo":"facebook/docusaurus","slug":"you-are-trying-to-create-client-side-redirections","errorCode":null,"errorMessage":"You are trying to create client-side redirections to invalid paths.\n","messagePattern":"You are trying to create client-side redirections to invalid paths\\.\n","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/docusaurus-plugin-client-redirects/src/collectRedirects.ts","lineNumber":162,"sourceCode":"      message += `\nThese paths do exist, but because you have explicitly set trailingSlash=${trailingSlashConfig}, you need to write the path ${\n        trailingSlashConfig ? 'with trailing slash' : 'without trailing slash'\n      }:\n- ${trailingSlashIssues.map(([p]) => p).join('\\n- ')}\n`;\n    }\n\n    if (invalidPaths.length) {\n      message += `\nThese paths are redirected to but do not exist:\n- ${invalidPaths.map(([p]) => p).join('\\n- ')}\n\nValid paths you can redirect to:\n- ${allowedToPaths.join('\\n- ')}\n`;\n    }\n\n    throw new Error(message);\n  }\n}\n\nfunction filterUnwantedRedirects(\n  redirects: RedirectItem[],\n  pluginContext: PluginContext,\n): RedirectItem[] {\n  // We don't want to create the same redirect twice, since that would lead to\n  // writing the same html redirection file twice.\n  Object.entries(_.groupBy(redirects, (redirect) => redirect.from)).forEach(\n    ([from, groupedFromRedirects]) => {\n      if (groupedFromRedirects.length > 1) {\n        logger.report(\n          pluginContext.siteConfig.onDuplicateRoutes,\n        )`name=${'@docusaurus/plugin-client-redirects'}: multiple redirects are created with the same \"from\" pathname: path=${from}\nIt is not possible to redirect the same pathname to multiple destinations:${groupedFromRedirects.map(\n          (r) => JSON.stringify(r),\n        )}`;","sourceCodeStart":144,"sourceCodeEnd":180,"githubUrl":"https://github.com/facebook/docusaurus/blob/3f483e80e326cc646b54b83d564b3f0c4881b9a6/packages/docusaurus-plugin-client-redirects/src/collectRedirects.ts#L144-L180","documentation":"Thrown by validateCollectedRedirects() in @docusaurus/plugin-client-redirects when one or more redirects point to a `to` path that does not exist as a route (or exists only with a different trailing-slash form than what trailingSlash config permits). The error message distinguishes trailing-slash issues from truly nonexistent paths and lists both the bad paths and the valid alternatives.","triggerScenarios":"A redirect whose to:'/guide' when the site only has '/guide/' (or vice versa) while trailingSlash is explicitly set; a redirect to a path that was never created; renaming a doc and forgetting to update its redirects.","commonSituations":"Changing the trailingSlash config and forgetting to update redirect targets; renaming/moving a doc without updating createRedirects; pointing redirects at a path that is itself generated by a plugin that was disabled.","solutions":["If the error says 'because you have explicitly set trailingSlash=...', rewrite each listed path with (or without) the trailing slash to match your config.","If the error says 'do not exist', point each listed redirect.to at one of the 'Valid paths' also printed in the message.","Re-run the build; the validator re-checks the full list."],"exampleFix":"// before (trailingSlash: true)\nredirects: [{ from: '/old', to: '/guide' }]\n// after\nredirects: [{ from: '/old', to: '/guide/' }]","handlingStrategy":"validation","validationCode":"import {addTrailingSlash, removeTrailingSlash} from '@docusaurus/utils-common';\nfunction alignWithTrailingSlash(p: string, trailingSlash: boolean | undefined): string {\n  if (trailingSlash === true) return addTrailingSlash(p);\n  if (trailingSlash === false) return removeTrailingSlash(p);\n  return p;\n}\n// apply to each redirect.to before passing to the plugin","typeGuard":null,"tryCatchPattern":null,"preventionTips":["When you change trailingSlash, audit every redirect.to.","Point redirects at canonical route paths printed by the validator.","Keep redirects and route generation in the same config so they stay in sync."],"tags":["plugin-client-redirects","redirects","trailing-slash","validation","build"],"backgroundTag":null,"analyzedSha":"3f483e80e326cc646b54b83d564b3f0c4881b9a6","analyzedAt":"2026-08-12T13:25:04.382Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}