nodejs/node · error · MBErr

Duplicate targets in isolate map files: %s.

Error message

Duplicate targets in isolate map files: %s.

What it means

ReadIsolateMap() merges multiple isolate map files into one dict. After parsing each file it computes `set(isolate_map).intersection(isolate_maps)`; if any target key already exists from a previously-loaded file, it raises MBErr('Duplicate targets in isolate map files: %s') listing the duplicated keys. Each target must be defined in exactly one map file.

Source

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

    self.configs = contents['configs']
    self.luci_tryservers = contents.get('luci_tryservers', {})
    self.builder_groups = contents['builder_groups']
    self.mixins = contents['mixins']

  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:

View on GitHub (pinned to 1b2de5e052)

Solutions

  1. Identify the duplicate target(s) in the error message and remove the definition from one of the files so each target appears in exactly one map.
  2. If you intended to override, edit the default map instead of layering a second -i file.
  3. Re-run with a single -i file or deduplicate the keys before retrying.

Example fix

// before
  # gn_isolate_map.pyl defines 'v8_unittests'
  mb.py gen -i custom.pyl ...   # custom.pyl ALSO defines 'v8_unittests'
// after
  # remove 'v8_unittests' from custom.pyl, then:
  mb.py gen -i custom.pdl ...
Defensive patterns

Strategy: validation

Validate before calling

seen = set()
for f in isolate_map_files:
    keys = set(ast.literal_eval(open(f).read()))
    dup = keys & seen
    if dup: sys.exit(f'duplicate targets across map files: {sorted(dup)}')
    seen |= keys

Type guard

null

Try / catch

null

Prevention

When it happens

Trigger: Passing two or more -i isolate map files that both define the same target name. The intersection is non-empty and MBErr names the duplicates.

Common situations: Overriding the default map with a custom -i that re-declares a target already in gn_isolate_map.pyl; merging two map files that overlap; a copy-paste that duplicated a target block across files.

Related errors


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