nodejs/node · error · MBErr

MB is expecting GN_ARGS to be in the environment

Error message

MB is expecting GN_ARGS to be in the environment

What it means

When a config enables cros_passthrough (ChromeOS pass-through), MB does not use the config's static gn_args; instead it reads raw GN args from the GN_ARGS environment variable. If GN_ARGS is unset, MB cannot proceed and aborts.

Source

Thrown at deps/v8/tools/mb/mb.py:956

    elif self.platform == 'darwin':
      subdir, exe = 'mac', 'gn'
    else:
      subdir, exe = 'win', 'gn.exe'

    arch = platform.machine()
    if (arch.startswith('s390') or arch.startswith('ppc') or
        self.platform.startswith('aix')):
      # use gn in PATH
      gn_path = 'gn'
    else:
      gn_path = self.PathJoin(self.chromium_src_dir, 'buildtools', subdir, exe)
    return [gn_path, subcommand, path] + list(args)


  def GNArgs(self, vals, expand_imports=False):
    if vals['cros_passthrough']:
      if not 'GN_ARGS' in os.environ:
        raise MBErr('MB is expecting GN_ARGS to be in the environment')
      gn_args = os.environ['GN_ARGS']
      if not re.search('target_os.*=.*"chromeos"', gn_args):
        raise MBErr('GN_ARGS is missing target_os = "chromeos": (GN_ARGS=%s)' %
                    gn_args)
    else:
      gn_args = vals['gn_args']

    android_version_code = self.args.android_version_code
    if android_version_code:
      gn_args += ' android_default_version_code="%s"' % android_version_code

    android_version_name = self.args.android_version_name
    if android_version_name:
      gn_args += ' android_default_version_name="%s"' % android_version_name

    args_gn_lines = []
    parsed_gn_args = {}

View on GitHub (pinned to 1b2de5e052)

Solutions

  1. Export GN_ARGS in the calling shell before invoking MB.
  2. Confirm the config really should be cros_passthrough; otherwise remove that mixin.
  3. Drive the build through the proper ChromeOS wrapper/recipe that sets GN_ARGS.

Example fix

// before
v8/tools/mb/mb.py gen -m client.v8 -b chromeos-builder out/cros
// after
GN_ARGS='target_os="chromeos" use_system_minigbm=true ...' \
  v8/tools/mb/mb.py gen -m client.v8 -b chromeos-builder out/cros
Defensive patterns

Strategy: validation

Validate before calling

import os
if config_enables_cros_passthrough(config):
    assert 'GN_ARGS' in os.environ, (
        "GN_ARGS must be exported for cros_passthrough configs")

Prevention

When it happens

Trigger: Invoking MB with a config whose transitive mixins set 'cros_passthrough': True while the process environment has no GN_ARGS variable.

Common situations: Running a ChromeOS builder recipe locally without exporting GN_ARGS; CI regression stripping env vars; wrong config selected for a non-ChromeOS workflow.

Related errors


AI-assisted analysis of nodejs/node@1b2de5e052 (2026-08-13). Data as JSON: /api/errors/3cca1e552e5d36f4. Report an issue: GitHub.