nodejs/node · error · Exception

Not enough arguments

Error message

Not enough arguments

What it means

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.

Source

Thrown at tools/gyp/pylib/gyp/win_tool.py:41

# link.exe.
_LINK_EXE_OUT_ARG = re.compile("/OUT:(?P<out>.+)$", re.IGNORECASE)


def main(args):
    executor = WinTool()
    if (exit_code := executor.Dispatch(args)) is not None:
        sys.exit(exit_code)


class WinTool:
    """This class performs all the Windows tooling steps. The methods can either
    be executed directly, or dispatched from an argument list."""

    def _UseSeparateMspdbsrv(self, env, args):
        """Allows to use a unique instance of mspdbsrv.exe per linker instead of a
        shared one."""
        if len(args) < 1:
            raise Exception("Not enough arguments")

        if args[0] != "link.exe":
            return

        # Use the output filename passed to the linker to generate an endpoint name
        # for mspdbsrv.exe.
        endpoint_name = None
        for arg in args:
            m = _LINK_EXE_OUT_ARG.match(arg)
            if m:
                endpoint_name = re.sub(
                    r"\W+", "", "%s_%d" % (m.group("out"), os.getpid())
                )
                break

        if endpoint_name is None:
            return

View on GitHub (pinned to 1b2de5e052)

Solutions

  1. Run a clean build: delete the output directory (out/ or build/) and regenerate the project with gyp to rebuild correct ninja rules.
  2. 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.
  3. 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 ...
  4. Check that the GYP toolchain and msvs_emulation environment were set up correctly so ExecLinkWrapper receives real linker args.

Example fix

// before: empty args cause the exception
gyp-win-tool link-wrapper x86 True
// after: supply the linker command line
gyp-win-tool link-wrapper x86 True link.exe /OUT:app.exe main.obj
Defensive patterns

Strategy: validation

Validate before calling

# Before calling ExecLinkWrapper / _UseSeparateMspdbsrv, ensure linker args are present
if not linker_args:
    raise ValueError('linker args must not be empty when using separate mspdbsrv')

Try / catch

try:
    executor.Dispatch(args)
except Exception as e:
    if 'Not enough arguments' in str(e):
        sys.exit('gyp-win-tool: missing arguments — regenerate the build with gyp')
    raise

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


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