{"record":{"id":"2589d3e8ccda7066","repo":"nodejs/node","slug":"expected-a-single-path-argument","errorCode":null,"errorMessage":"Expected a single path argument.","messagePattern":"Expected a single path argument\\.","errorType":"exception","errorClass":"RuntimeError","httpStatus":null,"severity":"error","filePath":"deps/v8/tools/vim/ninja_output.py","lineNumber":70,"sourceCode":"    # This is a heuristic; don't recurse into subdirectories.\n    paths = [path] + [os.path.join(path, f) for f in os.listdir(path)]\n    return max(filter(None, [safe_mtime(p) for p in paths]))\n\n  def safe_mtime(path):\n    try:\n      return os.path.getmtime(path)\n    except OSError:\n      return None\n\n  try:\n    return max(generate_paths(), key=approx_directory_mtime)\n  except ValueError:\n    raise RuntimeError('Unable to find a valid ninja output directory.')\n\n\nif __name__ == '__main__':\n  if len(sys.argv) != 2:\n    raise RuntimeError('Expected a single path argument.')\n  print(GetNinjaOutputDirectory(sys.argv[1]))\n","sourceCodeStart":52,"sourceCodeEnd":72,"githubUrl":"https://github.com/nodejs/node/blob/1b2de5e052fc0fb95fd7fb6846dcec4ade598e9e/deps/v8/tools/vim/ninja_output.py#L52-L72","documentation":"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.","triggerScenarios":"Running python ninja_output.py with zero arguments or more than one argument (e.g. passing multiple paths, or no path at all).","commonSituations":"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.","solutions":["Invoke with exactly one argument: python tools/vim/ninja_output.py /path/to/v8.","If invoked from a Vim plugin, check its g:syntastic / ale config passes a single project root."],"exampleFix":"# before\npython tools/vim/ninja_output.py\n# after\npython tools/vim/ninja_output.py /path/to/v8","handlingStrategy":"validation","validationCode":"import sys\nif len(sys.argv) != 2:\n    raise SystemExit('Usage: python tools/vim/ninja_output.py <project-root>')","typeGuard":"null","tryCatchPattern":"null","preventionTips":["Always pass exactly one project-root argument.","Wrap the Vim mapping in a helper that validates argv length before calling."],"tags":["v8","vim","cli","arguments"],"backgroundTag":null,"analyzedSha":"1b2de5e052fc0fb95fd7fb6846dcec4ade598e9e","analyzedAt":"2026-08-13T00:53:24.642Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}