nodejs/node · error · MBErr

Must specify a build --phase for %s on %s

Error message

Must specify a build --phase for %s on %s

What it means

When the resolved builder config is a dict (a multi-phase builder, e.g. separate build/test phases), ConfigFromArgs() requires --phase to select which phase to use. If self.args.phase is None while config is a dict, it raises MBErr('Must specify a build --phase for %s on %s'). The companion error 'Must not specify a build --phase' fires for the inverse mismatch (phase given but config is a plain string).

Source

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

    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"' %
                  (self.args.builder_group, self.args.config_file))

    config = _v8_builder_fallback(
        self.args.builder, self.builder_groups[self.args.builder_group])

    if not config:
      raise MBErr(
        'Builder name "%s"  not found under builder_groups[%s] in "%s"' %
        (self.args.builder, self.args.builder_group, self.args.config_file))

    if isinstance(config, dict):
      if self.args.phase is None:
        raise MBErr('Must specify a build --phase for %s on %s' %
                    (self.args.builder, self.args.builder_group))
      phase = str(self.args.phase)
      if phase not in config:
        raise MBErr('Phase %s doesn\'t exist for %s on %s' %
                    (phase, self.args.builder, self.args.builder_group))
      return config[phase]

    if self.args.phase is not None:
      raise MBErr('Must not specify a build --phase for %s on %s' %
                  (self.args.builder, self.args.builder_group))
    return config

  def FlattenConfig(self, config):
    mixins = self.configs[config]
    vals = self.DefaultVals()

    visited = []
    self.FlattenMixins(mixins, vals, visited)

View on GitHub (pinned to 1b2de5e052)

Solutions

  1. Add `--phase <n>` (typically 0 or 1) matching a key in the builder's phase dict.
  2. Inspect builder_groups[<group>][<builder>] in mb_config.pyl to see the valid phase keys.
  3. If the builder should be single-phase, change its config value from a dict to a plain config string.

Example fix

// before
  mb.py gen -m tryserver.v8 -b "V8 Win32 - builder" out/Default   // dict config
// after
  mb.py gen -m tryserver.v8 -b "V8 Win32 - builder" --phase 1 out/Default
Defensive patterns

Strategy: validation

Validate before calling

cfg = _v8_builder_fallback(args.builder, builder_groups[args.builder_group])
if isinstance(cfg, dict) and args.phase is None:
    sys.exit(f'builder {args.builder!r} is multi-phase; pass --phase one of {sorted(cfg)}')
if not isinstance(cfg, dict) and args.phase is not None:
    sys.exit(f'builder {args.builder!r} is single-phase; do not pass --phase')

Type guard

null

Try / catch

null

Prevention

When it happens

Trigger: Running `mb.py gen -m <group> -b <multi-phase-builder>` without `--phase <n>` where the builder's config value in mb_config.pyl is a dict like {'0': '...', '1': '...'}. isinstance(config, dict) is true and phase is None.

Common situations: A builder that was converted to multi-phase (e.g. for build/test splitting) but the caller's recipe wasn't updated to pass --phase; copy-pasting a command for a single-phase builder against a now-multi-phase one.

Related errors


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