nodejs/node · error · MBErr

Failed to parse isolate map file "%s": %s

Error message

Failed to parse isolate map file "%s": %s

What it means

ReadIsolateMap() parses each isolate map file with ast.literal_eval. On SyntaxError it re-raises as MBErr('Failed to parse isolate map file "%s": %s') chaining the cause. Note the format args use the post-parse variable name `isolate_map` (which has been reassigned to the file contents), so the filename in the message may be misleading — cross-check with the -i list.

Source

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

  def ReadIsolateMap(self):
    if not self.args.isolate_map_files:
      self.args.isolate_map_files = [self.default_isolate_map]

    for f in self.args.isolate_map_files:
      if not self.Exists(f):
        raise MBErr('isolate map file not found at %s' % f)
    isolate_maps = {}
    for isolate_map in self.args.isolate_map_files:
      try:
        isolate_map = ast.literal_eval(self.ReadFile(isolate_map))
        duplicates = set(isolate_map).intersection(isolate_maps)
        if duplicates:
          raise MBErr(
              'Duplicate targets in isolate map files: %s.' %
              ', '.join(duplicates))
        isolate_maps.update(isolate_map)
      except SyntaxError as e:
        raise MBErr('Failed to parse isolate map file "%s": %s' %
                    (isolate_map, e)) from e
    return isolate_maps

  def ConfigFromArgs(self):
    if self.args.config:
      if self.args.builder_group or self.args.builder:
        raise MBErr(
          'Can not specific both -c/--config and -m/--builder-group or '
          '-b/--builder')

      return self.args.config

    if not self.args.builder_group or not self.args.builder:
      raise MBErr('Must specify either -c/--config or '
                  '(-m/--builder-group and -b/--builder)')

    if not self.args.builder_group in self.builder_groups:
      raise MBErr('Builder groups name "%s" not found in "%s"' %

View on GitHub (pinned to 1b2de5e052)

Solutions

  1. Validate each -i file with `python3 -c "import ast; ast.literal_eval(open('<file>').read())"` to find the exact parse error, then fix it.
  2. Remove any unresolved merge-conflict markers from the isolate map.
  3. If the error message's filename looks wrong (due to the variable reuse), check all -i files, not just the named one.

Example fix

// before
  'v8_unittests': {
    'label': '//test/cctest:cctest'   // missing closing brace
// after
  'v8_unittests': {
    'label': '//test/cctest:cctest',
    'type': 'console_test_launcher',
  },
Defensive patterns

Strategy: validation

Validate before calling

import ast
for f in isolate_map_files:
    try:
        ast.literal_eval(open(f).read())
    except SyntaxError as e:
        sys.exit(f'isolate map {f} parse error at line {e.lineno}: {e.msg}')

Type guard

null

Try / catch

try:
    data = ast.literal_eval(text)
except SyntaxError as e:
    raise MBErr(f'Failed to parse isolate map file "{path}": {e}') from e

Prevention

When it happens

Trigger: An isolate map file (default gn_isolate_map.pyl or any -i file) is not a valid Python literal: unbalanced brackets, bad quoting, invalid token. ast.literal_eval raises SyntaxError, caught and converted.

Common situations: Hand-editing an isolate map and introducing a syntax error; merge-conflict markers left in; a stray trailing comma or missing quote; tab/space mixing in the literal.

Understand the failure class

Related errors


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