nodejs/node · error · MBErr

Error %s writing to the output path "%s"

Error message

Error %s writing to the output path "%s"

What it means

WriteJSON serializes obj to JSON and writes it via WriteFile. Any failure in WriteFile (permission denied, missing parent directory, out of space, force_verbose guard rejection, read-only mount) is wrapped into this MBErr with the underlying exception chained via `from e`.

Source

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

    for k in required_keys:
      if not k in inp:
        self.WriteFailureAndRaise('input file is missing a "%s" key' % k,
                                  output_path)

    return inp

  def WriteFailureAndRaise(self, msg, output_path):
    if output_path:
      self.WriteJSON({'error': msg}, output_path, force_verbose=True)
    raise MBErr(msg)

  def WriteJSON(self, obj, path, force_verbose=False):
    try:
      self.WriteFile(path, json.dumps(obj, indent=2, sort_keys=True) + '\n',
                     force_verbose=force_verbose)
    except Exception as e:
      raise MBErr('Error %s writing to the output path "%s"' %
                 (e, path)) from e

  def CheckCompile(self, builder_group, builder):
    url_template = self.args.url_template + '/{builder}/builds/_all?as_text=1'
    url = quote(
            url_template.format(builder_group=builder_group, builder=builder),
            safe=':/()?=')
    try:
      builds = json.loads(self.Fetch(url))
    except Exception as e:
      return str(e)
    successes = sorted(
        [int(x) for x in builds.keys() if "text" in builds[x] and
          cmp(builds[x]["text"][:2], ["build", "successful"]) == 0],
        reverse=True)
    if not successes:
      return "no successful builds"
    build = builds[str(successes[0])]

View on GitHub (pinned to 1b2de5e052)

Solutions

  1. Ensure the parent directory of the output path exists (create it first).
  2. Check write permissions on the build/output tree.
  3. Free disk space / raise quota.
  4. Point --output-path at a writable location.

Example fix

// before
v8/tools/mb/mb.py gen ... --output-path /readonly/out.json
// after
mkdir -p out && v8/tools/mb/mb.py gen ... --output-path out/mb.json
Defensive patterns

Strategy: validation

Validate before calling

import os, tempfile
d = os.path.dirname(output_path)
assert os.path.isdir(d), f"output dir {d!r} does not exist"
assert os.access(d, os.W_OK), f"output dir {d!r} is not writable"
# also a best-effort space check
shutil.disk_usage(d)

Try / catch

try:
    mb_run()
except MBErr as e:
    if 'writing to the output path' in str(e):
        log.error('MB output unwritable: %s', e); raise
    raise

Prevention

When it happens

Trigger: Any MB subcommand that emits a JSON artifact (--goma-config, --swarming-targets-file, gen with output JSON, etc.) when the output path is not writable.

Common situations: Output path's parent directory does not exist; permission denied on the build/output tree; disk full or quota exceeded; read-only mount in a sandboxed CI.

Related errors


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