angular/angular · error · RuntimeError

RuntimeErrorCode.PLATFORM_NOT_FOUND

RuntimeErrorCode.PLATFORM_NOT_FOUND

Error message

Missing Platform: This may be due to using `bootstrapApplication` on the server without passing a `BootstrapContext`. Please make sure that `bootstrapApplication` is called with a `context` argument.

What it means

Error "Missing Platform: This may be due to using `bootstrapApplication` on the server without passing a `BootstrapContext`. Please make sure that `bootstrapApplication` is called with a `context` argument." thrown in angular/angular.

Source

Thrown at packages/core/src/application/create_application.ts:48

 * Platforms (such as `platform-browser`) may require different set of application and platform
 * providers for an application to function correctly. As a result, platforms may use this function
 * internally and supply the necessary providers during the bootstrap, while exposing
 * platform-specific APIs as a part of their public API.
 *
 * @returns A promise that returns an `ApplicationRef` instance once resolved.
 */

export function internalCreateApplication(config: {
  rootComponent?: Type<unknown>;
  appProviders?: Array<Provider | EnvironmentProviders>;
  platformProviders?: Provider[];
  platformRef?: PlatformRef;
}): Promise<ApplicationRef> {
  const {rootComponent, appProviders, platformProviders, platformRef} = config;
  profiler(ProfilerEvent.BootstrapApplicationStart);

  if (typeof ngServerMode !== 'undefined' && ngServerMode && !platformRef) {
    throw new RuntimeError(
      RuntimeErrorCode.PLATFORM_NOT_FOUND,
      ngDevMode &&
        'Missing Platform: This may be due to using `bootstrapApplication` on the server without passing a `BootstrapContext`. ' +
          'Please make sure that `bootstrapApplication` is called with a `context` argument.',
    );
  }

  try {
    const platformInjector =
      platformRef?.injector ?? createOrReusePlatformInjector(platformProviders as StaticProvider[]);

    if ((typeof ngDevMode === 'undefined' || ngDevMode) && rootComponent !== undefined) {
      assertStandaloneComponentType(rootComponent);
    }

    // Create root application injector based on a set of providers configured at the platform
    // bootstrap level as well as providers passed to the bootstrap call by a user.
    const allAppProviders = [

View on GitHub (pinned to 51cb07e980)

Solutions

  1. Pass a BootstrapContext: bootstrapApplication(AppComponent, config, context) when bootstrapping on the server.

When it happens

Trigger: Thrown at packages/core/src/application/create_application.ts:48 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of angular/angular@51cb07e980 (2026-08-22). Data as JSON: /api/errors/9196f3c63f4a9224. Report an issue: GitHub.