nodejs/node · error · RuntimeError

Expected a single path argument.

Error message

Expected a single path argument.

What it means

Raised in the __main__ block of deps/v8/tools/vim/ninja_output.py when the script is invoked with a number of arguments other than exactly one. The CLI expects a single project-path argument and prints the resolved ninja output directory.

Source

Thrown at deps/v8/tools/vim/ninja_output.py:70

    # This is a heuristic; don't recurse into subdirectories.
    paths = [path] + [os.path.join(path, f) for f in os.listdir(path)]
    return max(filter(None, [safe_mtime(p) for p in paths]))

  def safe_mtime(path):
    try:
      return os.path.getmtime(path)
    except OSError:
      return None

  try:
    return max(generate_paths(), key=approx_directory_mtime)
  except ValueError:
    raise RuntimeError('Unable to find a valid ninja output directory.')


if __name__ == '__main__':
  if len(sys.argv) != 2:
    raise RuntimeError('Expected a single path argument.')
  print(GetNinjaOutputDirectory(sys.argv[1]))

View on GitHub (pinned to 1b2de5e052)

Solutions

  1. Invoke with exactly one argument: python tools/vim/ninja_output.py /path/to/v8.
  2. If invoked from a Vim plugin, check its g:syntastic / ale config passes a single project root.

Example fix

# before
python tools/vim/ninja_output.py
# after
python tools/vim/ninja_output.py /path/to/v8
Defensive patterns

Strategy: validation

Validate before calling

import sys
if len(sys.argv) != 2:
    raise SystemExit('Usage: python tools/vim/ninja_output.py <project-root>')

Type guard

null

Try / catch

null

Prevention

When it happens

Trigger: Running python ninja_output.py with zero arguments or more than one argument (e.g. passing multiple paths, or no path at all).

Common situations: Calling the script directly from a shell/Vim mapping with the wrong argument count; a wrapper that passes extra flags the script doesn't understand.

Related errors


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