{"record":{"id":"27391c111044821d","repo":"nodejs/node","slug":"error-s-writing-to-the-output-path-s","errorCode":null,"errorMessage":"Error %s writing to the output path \"%s\"","messagePattern":"Error (.+?) writing to the output path \"(.+?)\"","errorType":"exception","errorClass":"MBErr","httpStatus":null,"severity":"error","filePath":"deps/v8/tools/mb/mb.py","lineNumber":1168,"sourceCode":"\n    for k in required_keys:\n      if not k in inp:\n        self.WriteFailureAndRaise('input file is missing a \"%s\" key' % k,\n                                  output_path)\n\n    return inp\n\n  def WriteFailureAndRaise(self, msg, output_path):\n    if output_path:\n      self.WriteJSON({'error': msg}, output_path, force_verbose=True)\n    raise MBErr(msg)\n\n  def WriteJSON(self, obj, path, force_verbose=False):\n    try:\n      self.WriteFile(path, json.dumps(obj, indent=2, sort_keys=True) + '\\n',\n                     force_verbose=force_verbose)\n    except Exception as e:\n      raise MBErr('Error %s writing to the output path \"%s\"' %\n                 (e, path)) from e\n\n  def CheckCompile(self, builder_group, builder):\n    url_template = self.args.url_template + '/{builder}/builds/_all?as_text=1'\n    url = quote(\n            url_template.format(builder_group=builder_group, builder=builder),\n            safe=':/()?=')\n    try:\n      builds = json.loads(self.Fetch(url))\n    except Exception as e:\n      return str(e)\n    successes = sorted(\n        [int(x) for x in builds.keys() if \"text\" in builds[x] and\n          cmp(builds[x][\"text\"][:2], [\"build\", \"successful\"]) == 0],\n        reverse=True)\n    if not successes:\n      return \"no successful builds\"\n    build = builds[str(successes[0])]","sourceCodeStart":1150,"sourceCodeEnd":1186,"githubUrl":"https://github.com/nodejs/node/blob/1b2de5e052fc0fb95fd7fb6846dcec4ade598e9e/deps/v8/tools/mb/mb.py#L1150-L1186","documentation":"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`.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Ensure the parent directory of the output path exists (create it first).","Check write permissions on the build/output tree.","Free disk space / raise quota.","Point --output-path at a writable location."],"exampleFix":"// before\nv8/tools/mb/mb.py gen ... --output-path /readonly/out.json\n// after\nmkdir -p out && v8/tools/mb/mb.py gen ... --output-path out/mb.json","handlingStrategy":"validation","validationCode":"import os, tempfile\nd = os.path.dirname(output_path)\nassert os.path.isdir(d), f\"output dir {d!r} does not exist\"\nassert os.access(d, os.W_OK), f\"output dir {d!r} is not writable\"\n# also a best-effort space check\nshutil.disk_usage(d)","typeGuard":null,"tryCatchPattern":"try:\n    mb_run()\nexcept MBErr as e:\n    if 'writing to the output path' in str(e):\n        log.error('MB output unwritable: %s', e); raise\n    raise","preventionTips":["Create the output dir before invoking MB.","Run CI with a writable, spacious work volume.","Avoid read-only mounts for build outputs."],"tags":["mb","filesystem","io","v8","error-handling"],"backgroundTag":null,"analyzedSha":"1b2de5e052fc0fb95fd7fb6846dcec4ade598e9e","analyzedAt":"2026-08-13T00:53:24.642Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}