{"record":{"id":"3cca1e552e5d36f4","repo":"nodejs/node","slug":"mb-is-expecting-gn-args-to-be-in-the-environment","errorCode":null,"errorMessage":"MB is expecting GN_ARGS to be in the environment","messagePattern":"MB is expecting GN_ARGS to be in the environment","errorType":"exception","errorClass":"MBErr","httpStatus":null,"severity":"error","filePath":"deps/v8/tools/mb/mb.py","lineNumber":956,"sourceCode":"    elif self.platform == 'darwin':\n      subdir, exe = 'mac', 'gn'\n    else:\n      subdir, exe = 'win', 'gn.exe'\n\n    arch = platform.machine()\n    if (arch.startswith('s390') or arch.startswith('ppc') or\n        self.platform.startswith('aix')):\n      # use gn in PATH\n      gn_path = 'gn'\n    else:\n      gn_path = self.PathJoin(self.chromium_src_dir, 'buildtools', subdir, exe)\n    return [gn_path, subcommand, path] + list(args)\n\n\n  def GNArgs(self, vals, expand_imports=False):\n    if vals['cros_passthrough']:\n      if not 'GN_ARGS' in os.environ:\n        raise MBErr('MB is expecting GN_ARGS to be in the environment')\n      gn_args = os.environ['GN_ARGS']\n      if not re.search('target_os.*=.*\"chromeos\"', gn_args):\n        raise MBErr('GN_ARGS is missing target_os = \"chromeos\": (GN_ARGS=%s)' %\n                    gn_args)\n    else:\n      gn_args = vals['gn_args']\n\n    android_version_code = self.args.android_version_code\n    if android_version_code:\n      gn_args += ' android_default_version_code=\"%s\"' % android_version_code\n\n    android_version_name = self.args.android_version_name\n    if android_version_name:\n      gn_args += ' android_default_version_name=\"%s\"' % android_version_name\n\n    args_gn_lines = []\n    parsed_gn_args = {}\n","sourceCodeStart":938,"sourceCodeEnd":974,"githubUrl":"https://github.com/nodejs/node/blob/1b2de5e052fc0fb95fd7fb6846dcec4ade598e9e/deps/v8/tools/mb/mb.py#L938-L974","documentation":"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.","triggerScenarios":"Invoking MB with a config whose transitive mixins set 'cros_passthrough': True while the process environment has no GN_ARGS variable.","commonSituations":"Running a ChromeOS builder recipe locally without exporting GN_ARGS; CI regression stripping env vars; wrong config selected for a non-ChromeOS workflow.","solutions":["Export GN_ARGS in the calling shell before invoking MB.","Confirm the config really should be cros_passthrough; otherwise remove that mixin.","Drive the build through the proper ChromeOS wrapper/recipe that sets GN_ARGS."],"exampleFix":"// before\nv8/tools/mb/mb.py gen -m client.v8 -b chromeos-builder out/cros\n// after\nGN_ARGS='target_os=\"chromeos\" use_system_minigbm=true ...' \\\n  v8/tools/mb/mb.py gen -m client.v8 -b chromeos-builder out/cros","handlingStrategy":"validation","validationCode":"import os\nif config_enables_cros_passthrough(config):\n    assert 'GN_ARGS' in os.environ, (\n        \"GN_ARGS must be exported for cros_passthrough configs\")","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Set GN_ARGS via the ChromeOS build wrapper, not by hand.","In recipes, assert the env var before invoking MB."],"tags":["mb","chromeos","environment","gn","v8"],"backgroundTag":null,"analyzedSha":"1b2de5e052fc0fb95fd7fb6846dcec4ade598e9e","analyzedAt":"2026-08-13T00:53:24.642Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}