{"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/294cab2f9b2e03af6b953820c7ab497c3c8b7ad9/src/Components/Web.JS/src/Boot.WebAssembly.Common.ts#L228-L264","documentation":"Thrown by updateWebAssemblyRootComponents when the module-level startPromise is undefined, i.e. startWebAssembly was never called. Root-component updates only make sense once the WebAssembly platform has begun booting, because they are forwarded to Blazor._internal.updateRootComponents which is wired up inside startCore.","triggerScenarios":"Calling Blazor._internal.updateRootComponents (or a higher-level API that routes to updateWebAssemblyRootComponents) before Blazor.start() has been invoked on the WebAssembly bundle.","commonSituations":"Custom code or an initializer that pushes root-component updates before boot; interactive WebAssembly render mode triggered before the bundle finished starting; tests exercising root-component plumbing without booting WebAssembly first.","solutions":["Await Blazor.start() before issuing any root-component update.","Guard with hasStartedWebAssembly() before calling updateWebAssemblyRootComponents.","Defer the update logic to an afterStarted callback so ordering is guaranteed."],"exampleFix":"// before: update before start\nBlazor._internal.updateRootComponents(ops, state); // throws\nawait Blazor.start();\n\n// after\nawait Blazor.start();\nBlazor._internal.updateRootComponents(ops, state);","handlingStrategy":"validation","validationCode":"import { hasStartedWebAssembly } from './Boot.WebAssembly.Common';\n\nfunction updateRootComponentsSafe(ops: string, state: string) {\n  if (!hasStartedWebAssembly()) {\n    throw new Error('Start WebAssembly before updating root components.');\n  }\n  updateWebAssemblyRootComponents(ops, state);\n}","typeGuard":"import { hasStartedWebAssembly } from './Boot.WebAssembly.Common';\n\nfunction canUpdateRoots(): boolean {\n  return hasStartedWebAssembly();\n}","tryCatchPattern":"try {\n  Blazor._internal.updateRootComponents(ops, state);\n} catch (e) {\n  if (/WebAssembly has not started/.test((e as Error).message)) {\n    await Blazor.start();\n    Blazor._internal.updateRootComponents(ops, state);\n  } else throw e;\n}","preventionTips":["Await Blazor.start() before any root-component update.","Guard with hasStartedWebAssembly().","Defer updates to an afterStarted callback.","Avoid issuing updates from initializers that run before boot."],"tags":["blazor-webassembly","root-components","startup","ordering"],"analyzedSha":"294cab2f9b2e03af6b953820c7ab497c3c8b7ad9","analyzedAt":"2026-08-06T20:08:02.189Z","schemaVersion":2},"datasetVersion":"2026-08-06T23:17:07.152Z"}