{"record":{"id":"71a708cecabcbac9","repo":"dotnet/aspnetcore","slug":"blazor-webassembly-has-not-started","errorCode":null,"errorMessage":"Blazor WebAssembly has not started.","messagePattern":"Blazor WebAssembly has not started\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"src/Components/Web.JS/src/Boot.WebAssembly.Common.ts","lineNumber":246,"sourceCode":"    await monoPlatform.load(finalOptions, resolveBootConfigPromise, justDownload);\n    if (!justDownload) {\n      loadedWebAssemblyPlatform = true;\n    }\n  })();\n  return platformLoadPromise;\n}\n\nexport function hasStartedLoadingWebAssemblyPlatform(): boolean {\n  return platformLoadPromise !== undefined;\n}\n\nexport function hasLoadedWebAssemblyPlatform(): boolean {\n  return loadedWebAssemblyPlatform;\n}\n\nexport function updateWebAssemblyRootComponents(operations: string, webAssemblyState: string): void {\n  if (!startPromise) {\n    throw new Error('Blazor WebAssembly has not started.');\n  }\n\n  if (!Blazor._internal.updateRootComponents) {\n    throw new Error('Blazor WebAssembly has not initialized.');\n  }\n\n  if (!started) {\n    scheduleAfterStarted(operations, webAssemblyState);\n  } else {\n    Blazor._internal.updateRootComponents(operations, webAssemblyState);\n  }\n}\n\nasync function scheduleAfterStarted(operations: string, webAssemblyState: string): Promise<void> {\n  await startPromise;\n\n  if (!Blazor._internal.updateRootComponents) {\n    throw new Error('Blazor WebAssembly has not initialized.');","sourceCodeStart":228,"sourceCodeEnd":264,"githubUrl":"https://github.com/dotnet/aspnetcore/blob/3600ca084e9c8b5f4174fc5e747f4c52d2100806/src/Components/Web.JS/src/Boot.WebAssembly.Common.ts#L228-L264","documentation":"Thrown by updateWebAssemblyRootComponents in Boot.WebAssembly.Common when the module-level startPromise is falsy — meaning startWebAssembly has never been called. Updating root components requires an already-booted WebAssembly runtime; calling it before boot would silently drop the update, so the framework throws.","triggerScenarios":"Framework code (e.g. enhanced-navigation or hot-reload handlers) invoking updateWebAssemblyRootComponents before Blazor WebAssembly has started, or in a context where the WebAssembly boot path was never entered (e.g. a Server-only page).","commonSituations":"A page configured for Server-only interactivity accidentally triggering the WebAssembly root-component update path; calling the API manually before start; routing from a WebAssembly page to a non-WebAssembly context and back during shutdown.","solutions":["Ensure Blazor WebAssembly has started (await Blazor.start()) before code that may trigger root-component updates.","Gate the call on hasStartedLoadingWebAssemblyPlatform() / hasLoadedWebAssemblyPlatform().","Confirm the page actually uses WebAssembly interactivity before invoking WebAssembly-specific APIs.","Avoid calling WebAssembly root-component APIs from code shared with Server-only pages."],"exampleFix":"// before\nBlazor._internal.updateRootComponents?.(ops, state); // can fire pre-start\n\n// after — gate on started state\nimport { hasLoadedWebAssemblyPlatform } from './Boot.WebAssembly.Common';\nif (hasLoadedWebAssemblyPlatform()) {\n  updateWebAssemblyRootComponents(ops, state);\n}","handlingStrategy":"validation","validationCode":"// Gate WebAssembly root-component updates on having started.\nimport { hasStartedLoadingWebAssemblyPlatform } from './Boot.WebAssembly.Common';\nfunction maybeUpdateRootComponents(ops, state) {\n  if (!hasStartedLoadingWebAssemblyPlatform()) return;\n  updateWebAssemblyRootComponents(ops, state);\n}","typeGuard":null,"tryCatchPattern":"try {\n  updateWebAssemblyRootComponents(ops, state);\n} catch (e) {\n  if (/has not started/.test(e.message)) {\n    // not a WebAssembly context; ignore\n  } else throw e;\n}","preventionTips":["Only call WebAssembly root-component APIs in pages that actually use WebAssembly.","Await Blazor.start() before issuing updates.","Use the framework's started-state accessors as gates.","Keep WebAssembly-specific code out of Server-only paths."],"tags":["blazor-webassembly","root-components","lifecycle","ordering"],"backgroundTag":null,"analyzedSha":"3600ca084e9c8b5f4174fc5e747f4c52d2100806","analyzedAt":"2026-08-11T16:32:30.678Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}