{"record":{"id":"c22d22f3fb3ae30c","repo":"nodejs/node","slug":"not-enough-arguments-c22d22","errorCode":null,"errorMessage":"Not enough arguments","messagePattern":"Not enough arguments","errorType":"exception","errorClass":"Exception","httpStatus":null,"severity":"error","filePath":"tools/gyp/pylib/gyp/win_tool.py","lineNumber":41,"sourceCode":"# link.exe.\n_LINK_EXE_OUT_ARG = re.compile(\"/OUT:(?P<out>.+)$\", re.IGNORECASE)\n\n\ndef main(args):\n    executor = WinTool()\n    if (exit_code := executor.Dispatch(args)) is not None:\n        sys.exit(exit_code)\n\n\nclass WinTool:\n    \"\"\"This class performs all the Windows tooling steps. The methods can either\n    be executed directly, or dispatched from an argument list.\"\"\"\n\n    def _UseSeparateMspdbsrv(self, env, args):\n        \"\"\"Allows to use a unique instance of mspdbsrv.exe per linker instead of a\n        shared one.\"\"\"\n        if len(args) < 1:\n            raise Exception(\"Not enough arguments\")\n\n        if args[0] != \"link.exe\":\n            return\n\n        # Use the output filename passed to the linker to generate an endpoint name\n        # for mspdbsrv.exe.\n        endpoint_name = None\n        for arg in args:\n            m = _LINK_EXE_OUT_ARG.match(arg)\n            if m:\n                endpoint_name = re.sub(\n                    r\"\\W+\", \"\", \"%s_%d\" % (m.group(\"out\"), os.getpid())\n                )\n                break\n\n        if endpoint_name is None:\n            return\n","sourceCodeStart":23,"sourceCodeEnd":59,"githubUrl":"https://github.com/nodejs/node/blob/1b2de5e052fc0fb95fd7fb6846dcec4ade598e9e/tools/gyp/pylib/gyp/win_tool.py#L23-L59","documentation":"Raised by WinTool._UseSeparateMspdbsrv when the args list passed to it is empty. This method is an internal helper that inspects linker command-line arguments to derive a unique mspdbsrv.exe endpoint name per link.exe invocation on Windows. An empty args list means gyp-win-tool's link wrapper was invoked without any linker arguments, which is an internal build-system malfunction rather than a user configuration error.","triggerScenarios":"WinTool.ExecLinkWrapper calls _UseSeparateMspdbsrv(env, args) with an empty args tuple. This occurs when the ninja generator emits a gyp-win-tool link-wrapper rule whose linker arguments are absent or stripped down to zero elements.","commonSituations":"Corrupted gyp .ninja rules after an interrupted or partial build regeneration. A hand-edited or machine-generated build file that invokes gyp-win-tool link-wrapper with no linker arguments. Very rarely seen in normal builds; indicates the build graph is inconsistent.","solutions":["Run a clean build: delete the output directory (out/ or build/) and regenerate the project with gyp to rebuild correct ninja rules.","Verify the target's .gyp/.gypi configuration has a valid 'sources' and 'linker_flags' / linker settings so the ninja generator emits non-empty linker command lines.","If invoking gyp-win-tool manually, ensure you pass the full linker argument list, e.g.: gyp-win-tool link-wrapper <arch> <use_separate_mspdbsrv> link.exe /OUT:foo.exe foo.obj ...","Check that the GYP toolchain and msvs_emulation environment were set up correctly so ExecLinkWrapper receives real linker args."],"exampleFix":"// before: empty args cause the exception\ngyp-win-tool link-wrapper x86 True\n// after: supply the linker command line\ngyp-win-tool link-wrapper x86 True link.exe /OUT:app.exe main.obj","handlingStrategy":"validation","validationCode":"# Before calling ExecLinkWrapper / _UseSeparateMspdbsrv, ensure linker args are present\nif not linker_args:\n    raise ValueError('linker args must not be empty when using separate mspdbsrv')","typeGuard":null,"tryCatchPattern":"try:\n    executor.Dispatch(args)\nexcept Exception as e:\n    if 'Not enough arguments' in str(e):\n        sys.exit('gyp-win-tool: missing arguments — regenerate the build with gyp')\n    raise","preventionTips":["Always regenerate gyp projects after changing .gyp files so ninja rules stay consistent.","Never invoke gyp-win-tool subcommands manually without the full argument list the build system expects."],"tags":["windows","gyp","build","mspdbsrv","linker"],"backgroundTag":null,"analyzedSha":"1b2de5e052fc0fb95fd7fb6846dcec4ade598e9e","analyzedAt":"2026-08-13T00:53:24.642Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}