angular/angular · error

Force GC is not supported on iOS

Error message

Force GC is not supported on iOS

What it means

The cached variable's initializer must be the _taggedTemplateLiteral(cooked, raw) call. unwrapLazyLoadHelperCall() throws this error when the initializer is anything else (an identifier, object literal, conditional, ...), because the template object cannot be unwrapped.

Source

Thrown at packages/benchpress/src/webdriver/ios_driver_extension.ts:23

 * Use of this source code is governed by an MIT-style license that can be
 * found in the LICENSE file at https://angular.dev/license
 */

import {Injectable} from '@angular/core';

import {WebDriverAdapter} from '../web_driver_adapter';
import {PerfLogEvent, PerfLogFeatures, WebDriverExtension} from '../web_driver_extension';

@Injectable()
export class IOsDriverExtension extends WebDriverExtension {
  static PROVIDERS = [{provide: IOsDriverExtension, deps: [WebDriverAdapter]}];

  constructor(private _driver: WebDriverAdapter) {
    super();
  }

  override gc(): Promise<any> {
    throw new Error('Force GC is not supported on iOS');
  }

  override timeBegin(name: string): Promise<any> {
    return this._driver.executeScript(`console.time('${name}');`);
  }

  override timeEnd(name: string, restartName: string | null = null): Promise<any> {
    let script = `console.timeEnd('${name}');`;
    if (restartName != null) {
      script += `console.time('${restartName}');`;
    }
    return this._driver.executeScript(script);
  }

  // See https://github.com/WebKit/webkit/tree/master/Source/WebInspectorUI/Versions
  override readPerfLog() {
    // TODO(tbosch): Bug in IOsDriver: Need to execute at least one command
    // so that the browser logs can be read out!

View on GitHub (pinned to 51cb07e980)

Solutions

  1. Remove custom transforms that rewrite template-object helper internals, or apply the localize step before them
  2. Rebuild the affected package from source
  3. Align toolchain versions
Defensive patterns

Strategy: try-catch

Type guard

function isBabelParseError(e: unknown): e is BabelParseError {
  return e instanceof Error && (e as any).type === 'BabelParseError';
}

Try / catch

try {
  const result = await babelTransformAsync(code, {plugins: [localizePlugin]});
} catch (e) {
  if (isBabelParseError(e)) {
    throw new Error(`Failed to translate ${filePath}: ${e.message}`);
  }
  throw e;
}

Prevention

When it happens

Trigger: A custom transform replaces or wraps the initializer expression of the helper's cached variable before the localize plugin processes the file.

Common situations: Custom build plugins rewriting helper internals; emit shapes from incompatible compiler versions.

Related errors


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