nodejs/node · error · Exception

This appears to not be called from a recent v8 checkout

Error message

This appears to not be called from a recent v8 checkout

What it means

v8gen.py's _find_work_dir() walks up the directory tree from the given path looking for a marker file `tools/dev/v8gen.py`, i.e. the V8 source root. If it reaches the filesystem root (`os.path.dirname(path) == path`) without finding the marker, it raises an Exception indicating the script is not running inside a V8 checkout.

Source

Thrown at deps/v8/tools/dev/v8gen.py:205

    self.verbose_print_1(' '.join(args))
    try:
      output = subprocess.check_output(
        args=args,
        stderr=subprocess.STDOUT,
      )
      self.verbose_print_2(output)
    except subprocess.CalledProcessError as e:
      self.verbose_print_2(e.output)
      raise

  def _find_work_dir(self, path):
    """Find the closest v8 root to `path`."""
    if os.path.exists(os.path.join(path, 'tools', 'dev', 'v8gen.py')):
      # Approximate the v8 root dir by a folder where this script exists
      # in the expected place.
      return path
    elif os.path.dirname(path) == path:
      raise Exception(
          'This appears to not be called from a recent v8 checkout')
    else:
      return self._find_work_dir(os.path.dirname(path))

  def _append_gn_args(self, type, gn_args_path, more_gn_args):
    """Append extra gn arguments to the generated args.gn file."""
    if not more_gn_args:
      return False
    self.verbose_print_1('Appending """\n%s\n""" to %s.' % (
        more_gn_args, os.path.abspath(gn_args_path)))
    with open(gn_args_path, 'a') as f:
      f.write('\n# Additional %s args:\n' % type)
      f.write(more_gn_args)
      f.write('\n')

    # Artificially increment modification time as our modifications happen too
    # fast. This makes sure that gn is properly rebuilding the ninja files.
    mtime = os.path.getmtime(gn_args_path) + 1

View on GitHub (pinned to 1b2de5e052)

Solutions

  1. cd into the V8 source root (the directory containing tools/dev/v8gen.py) and re-run, or pass an explicit --workdir pointing inside the checkout.
  2. Verify the marker exists: `ls tools/dev/v8gen.py` from your intended root.
  3. If the checkout is incomplete, re-run `fetch v8` / `gclient sync` to restore tools/dev/v8gen.py.

Example fix

// before
      raise Exception(
          'This appears to not be called from a recent v8 checkout')
// after
      raise Exception(
          'This appears to not be called from a recent v8 checkout '
          '(no tools/dev/v8gen.py found above %s)' % path)
Defensive patterns

Strategy: validation

Validate before calling

import os
root = os.getcwd()
while os.path.dirname(root) != root:
    if os.path.exists(os.path.join(root, 'tools', 'dev', 'v8gen.py')):
        break
    root = os.path.dirname(root)
else:
    sys.exit('Not inside a V8 checkout: tools/dev/v8gen.py not found above cwd')

Type guard

null

Try / catch

null

Prevention

When it happens

Trigger: Invoking v8gen.py with a working directory or `--workdir` path that is not inside a V8 source tree; symlinks that prevent the parent-walk from converging; running a copied v8gen.py from outside the repo. The recursion terminates only by finding the marker or hitting the FS root.

Common situations: Running v8gen from /tmp or a sibling directory; a partial checkout missing tools/dev/v8gen.py; a relocated/copied script invoked standalone; CI that cd's into the wrong workspace path.

Related errors


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