nodejs/node · error · MBErr

unrecognized platform string "%s"

Error message

unrecognized platform string "%s"

What it means

mb.py's _DefaultDimensions() computes Swarming/bot dimensions for buildbucket configs. It only recognizes sys.platform values 'darwin', anything starting with 'linux', and 'win32'. Any other platform string (e.g. 'cygwin', 'aix', 'win-amd64 variants) raises MBErr('unrecognized platform string "%s"'). This only fires when default_dimensions are being emitted (CmdBuildbucket path).

Source

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

      ]
    if self.args.extra_args:
      cmd += ['--'] + self.args.extra_args
    ret, _, _ = self.Run(cmd, force_verbose=True, buffer_output=False)
    return ret

  def _DefaultDimensions(self):
    if not self.args.default_dimensions:
      return []

    # This code is naive and just picks reasonable defaults per platform.
    if self.platform == 'darwin':
      os_dim = ('os', 'Mac-10.12')
    elif self.platform.startswith('linux'):
      os_dim = ('os', 'Ubuntu-16.04')
    elif self.platform == 'win32':
      os_dim = ('os', 'Windows-10')
    else:
      raise MBErr('unrecognized platform string "%s"' % self.platform)

    return [('pool', 'Chrome'),
            ('cpu', 'x86-64'),
            os_dim]

  def CmdBuildbucket(self):
    self.ReadConfigFile()

    self.Print('# This file was generated using '
               '"tools/mb/mb.py gerrit-buildbucket-config".')

    for luci_tryserver in sorted(self.luci_tryservers):
      self.Print('[bucket "luci.%s"]' % luci_tryserver)
      for bot in sorted(self.luci_tryservers[luci_tryserver]):
        self.Print('\tbuilder = %s' % bot)

    for builder_group in sorted(self.builder_groups):
      if builder_group.startswith('tryserver.'):

View on GitHub (pinned to 1b2de5e052)

Solutions

  1. Run mb.py under the native Python for your OS (CPython on Windows reports 'win32', on Linux reports 'linux*').
  2. If on Cygwin/MSYS, use a native Windows or WSL Python instead.
  3. Extend _DefaultDimensions() with an elif branch for your platform string returning the correct ('os', <dim>) tuple before the raise.

Example fix

// before
    else:
      raise MBErr('unrecognized platform string "%s"' % self.platform)
// after
    elif self.platform == 'win32' or self.platform == 'cygwin':
      os_dim = ('os', 'Windows-10')
    else:
      raise MBErr('unrecognized platform string "%s"' % self.platform)
Defensive patterns

Strategy: validation

Validate before calling

import sys
_supported = {'darwin'} | {p for p in ('linux', 'linux2') if p.startswith('linux')} | {'win32'}
if sys.platform not in _supported and args.default_dimensions:
    sys.exit(f'mb default-dimensions unsupported on sys.platform={sys.platform!r}')

Type guard

null

Try / catch

null

Prevention

When it happens

Trigger: Running `mb.py buildbucket-config` (or any path invoking _DefaultDimensions) on a host where sys.platform is not darwin/linux*/win32. The chain of elif checks falls through to the unconditional raise.

Common situations: Running mb under Cygwin/MSYS (sys.platform='cygwin'); on AIX/Solaris; or with a Python build reporting an unusual platform string. Most common is Windows users under a non-win32 Python interpreter.

Related errors


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