{"record":{"id":"86efb65d6eba57a2","repo":"dotnet/aspnetcore","slug":"only-one-interactive-runtime-may-enable-navigation","errorCode":null,"errorMessage":"Only one interactive runtime may enable navigation interception at a time.","messagePattern":"Only one interactive runtime may enable navigation interception at a time\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"src/Components/Web.JS/src/Services/NavigationUtils.ts","lineNumber":154,"sourceCode":"      if (candidate instanceof HTMLAnchorElement || candidate instanceof SVGAElement) {\n        return candidate;\n      }\n    }\n  }\n  return null;\n}\n\nexport function hasInteractiveRouter(): boolean {\n  return interactiveRouterRendererId !== undefined;\n}\n\nexport function getInteractiveRouterRendererId() : WebRendererId | undefined {\n  return interactiveRouterRendererId;\n}\n\nexport function setHasInteractiveRouter(rendererId: WebRendererId) {\n  if (interactiveRouterRendererId !== undefined && interactiveRouterRendererId !== rendererId) {\n    throw new Error('Only one interactive runtime may enable navigation interception at a time.');\n  }\n\n  interactiveRouterRendererId = rendererId;\n}\n","sourceCodeStart":136,"sourceCodeEnd":159,"githubUrl":"https://github.com/dotnet/aspnetcore/blob/3600ca084e9c8b5f4174fc5e747f4c52d2100806/src/Components/Web.JS/src/Services/NavigationUtils.ts#L136-L159","documentation":"Blazor allows only one interactive runtime to own router-level navigation interception at a time. setHasInteractiveRouter stores the rendererId of that owner and refuses to overwrite it with a different rendererId. hasInteractiveRouter/getInteractiveRouterRendererId expose the current owner. This enforces a single source of truth for link-click interception when multiple renderers coexist.","triggerScenarios":"Thrown at line 154 when setHasInteractiveRouter(rendererId) is called with a rendererId different from the already-set interactiveRouterRendererId (which is not undefined). Happens when a second interactive runtime attempts to register as the router after a first one already did.","commonSituations":"Loading both a Server and a WebAssembly interactive renderer with their own routers on the same page; misconfigured Auto render mode spinning up two interactive runtimes that both try to own the router; double-Blazor.start; version skew causing duplicate renderer initialization.","solutions":["Ensure only one interactive runtime registers as the interactive router on a page (typical: one render mode globally or per-page).","Avoid loading both blazor.web.js and a second interactive host on the same page.","Confirm you are not double-invoking Blazor.start or re-initializing the runtime.","Align client and server Blazor versions so the renderer registration happens once."],"exampleFix":"// before: two renderers both call setHasInteractiveRouter\n// after: only one interactive render mode per page\n// App.razor — pick ONE:\n<Routes @rendermode=\"InteractiveServer\" />\n<!-- or -->\n<Routes @rendermode=\"InteractiveWebAssembly\" />\n<!-- not both registered as routers simultaneously","handlingStrategy":"validation","validationCode":"import { hasInteractiveRouter } from './NavigationUtils';\n// before calling setHasInteractiveRouter\nif (hasInteractiveRouter()) {\n  // another renderer already owns routing; do not register again\n  return;\n}","typeGuard":null,"tryCatchPattern":"try {\n  setHasInteractiveRouter(rendererId);\n} catch (e) {\n  if (/Only one interactive runtime/i.test((e as Error).message)) {\n    // pick one render mode; reload to reset\n    window.location.reload();\n  } else throw e;\n}","preventionTips":["Run a single interactive render mode (Server OR WebAssembly OR Auto) per page.","Do not load two Blazor JS hosts on the same page.","Avoid double Blazor.start invocations.","Keep server and client Blazor versions identical."],"tags":["blazor","navigation","router","render-mode","multiple-runtimes"],"backgroundTag":null,"analyzedSha":"3600ca084e9c8b5f4174fc5e747f4c52d2100806","analyzedAt":"2026-08-11T16:32:30.678Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}