{"record":{"id":"34b6d6e70401adf5","repo":"nodejs/node","slug":"gn-args-is-missing-target-os-chromeos-gn-arg","errorCode":null,"errorMessage":"GN_ARGS is missing target_os = \"chromeos\": (GN_ARGS=%s)","messagePattern":"GN_ARGS is missing target_os = \"chromeos\": \\(GN_ARGS=(.+?)\\)","errorType":"exception","errorClass":"MBErr","httpStatus":null,"severity":"error","filePath":"deps/v8/tools/mb/mb.py","lineNumber":959,"sourceCode":"      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\n    args_file = vals.get('args_file', None)\n    if args_file:\n      if expand_imports:","sourceCodeStart":941,"sourceCodeEnd":977,"githubUrl":"https://github.com/nodejs/node/blob/1b2de5e052fc0fb95fd7fb6846dcec4ade598e9e/deps/v8/tools/mb/mb.py#L941-L977","documentation":"With cros_passthrough enabled, MB validates the user-supplied GN_ARGS contains a target_os=\"chromeos\" assignment (regex `target_os.*=.*\"chromeos\"`). Without it the build is semantically wrong because the whole point of cros_passthrough is to target ChromeOS.","triggerScenarios":"GN_ARGS is present in the environment but the substring `target_os = \"chromeos\"` (matching the regex) is absent.","commonSituations":"Recipe builds GNARGS but a typo/edit removed target_os; quoting/whitespace differs enough to miss the regex; args were truncated.","solutions":["Ensure GNARGS contains the literal substring: target_os=\"chromeos\".","Mind quoting/spacing — the matcher is `target_os.*=.*\"chromeos\"`.","Re-run MB with the corrected GNARGS environment."],"exampleFix":"// before\nGNARGS='is_debug=false use_system_minigbm=true'\n// after\nGNARGS='target_os=\"chromeos\" is_debug=false use_system_minigbm=true'","handlingStrategy":"validation","validationCode":"import os, re\nga = os.environ.get('GN_ARGS', '')\nassert re.search(r'target_os.*=.*\"chromeos\"', ga), (\n    'GN_ARGS must contain target_os=\"chromeos\"')","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Centralize GN_ARGS construction in one helper that always includes target_os for cros builders.","Add a unit test asserting the regex matches the constructed args."],"tags":["mb","chromeos","gn","environment","validation"],"backgroundTag":null,"analyzedSha":"1b2de5e052fc0fb95fd7fb6846dcec4ade598e9e","analyzedAt":"2026-08-13T00:53:24.642Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}