The NET HELPMSG command will decode Windows error codes, at least the simple ones


A quick and dirty way to convert Windows error codes to strings is to use the NET HELPMSG command.

C:\> NET HELPMSG 2

The system cannot find the file specified.

C:\> NET HELPMSG 8242

An invalid dn syntax has been specified.

The command is not infallible, however.

If you pass a message with an insertion, such as ERROR_WRONG_DISK, then instead of getting

The wrong diskette is in the drive.
Insert %2 (Volume Serial Number: %3) into drive %1.

you get¹

C:\> NET HELPMSG 34

34 is not a valid Windows network message number.

More help is available by typing NET HELPMSG 3871.

Still, it's better than nothing.

¹ As a bonus insult, if you type the suggested command, you get this:

C:\> NET HELPMSG 3871

*** is not a valid Windows network message number.

Yeah, um, that really didn't tell me anything new.

Comments (23)
  1. Brian says:

    Well at least “NET HELPMSG 3871” doesn’t include the note that NET HELPMSG 3871 would give you more help.

  2. Rich says:

    How did the NET command end up having so much non network related functionality in it? Such as starting and stopping services for example.

    1. ZLB says:

      Every project has a ‘Utils’ class…

    2. Joshua says:

      In this case; possibly because net start workstation was required to enable NetBIOS client side access under DOS. There were a few other services it could start too.

    3. cheong00 says:

      That’s because FormatMessage() can more kind of error message than just network related ones.

  3. mikeb says:

    Microsoft provides a download for a utility called “err.exe” written by the Exchange team a long while ago. It has a database of error codes from 127 headers. It’ll automatically try the error code as a decimal and/or hex value (as appropriate).

    Every Win dev or power user should have it.

    1. Brian says:

      On the topic of Microsoft error lookup utilities: I usually lookup errors using [Visual Studio Install Directory]\Common7\Tools\errlook.exe .

    2. mikeb says:

      Errorlook is convenient since it’s included with Visual Studio, but err.exe has the following advantages:

      it’s a console line program (for whatever reason, I find it slightly easier to use)
      it has a larger database of errors (such as NT status codes like 0xc0000005)
      it’ll interpret the error number you provide as both decimal and hex when possible. Errlook will interpret the value only one way. For example if you’re wondering about error code 15, you’d have to try both 15 and 0x15 if you weren’t sure if the number was decimal or hex. Err.exe will just tell you the errors for both interpretations.
      err.exe tells you which header the error value comes from

    3. Stefan Kanthak says:

      No user needs err.exe!
      Every user can use CERTUTIL.exe /error 0x……..
      CERTUTIL.exe is installed with Windows Server 2000 and Windows Server 2003, since Windows Vista with all versions.

      1. cheong00 says:

        Nice to learn something new today. Not aware of this usage before. :)

      2. morlamweb says:

        Thanks for mentioning certutil’s -error switch. I wasn’t aware of it. I might make use of it if I need to research an error code in a remote session. I’ll still use err.exe on my own machine as it’s the more capable tool.

      3. Wow! Rarely ever does a comment surpass its associated blog post!

        Thanks a bunch.

  4. Joshua Schaeffer says:

    There’s a better solution that I was going to save for my own utilities. I have ~30K lines of C# that contain exact enum definitions for Win32 interop (including HRESULT itself), and I also P/Invoked FormatMessage() for use with or without the inserts. If there’s enough support, we could put the mother of all error lookup utilities on github in very short time. .NET reflection can easily bounce you back and forth between integers and string identfiers, and search whole assembly namespaces.

  5. Michael says:

    After typing random error codes into net helpmsg. I found an interesting one:
    net helpmsg 565:
    Indicates a process has too many threads to perform the requested action. For example, assignment of a primary token may only be performed when a process has zero or one threads.

    Is a process with zero threads even a process? Does this ever happen?

    1. Michael-Paul jakovlevski says:

      This can happen if there is still a open handle to the process after all it’s threads have stopped.

      Similar to this:
      https://blogs.msdn.microsoft.com/oldnewthing/20150918-00/?p=91561

      1. Viila says:

        But without any threads, how does it even process the request in the first place?

        1. skSdnW says:

          The kernel just sets the property on the process object, the process itself does not need to execute any code.

  6. Gee Law says:

    I was working on some networking code recently and had been using net helpmsg. I know that there is a “net” in the command, but “net user” doesn’t require a domain (it can operate on local machine and has nothing to do with networking!), therefore I assumed “net” must have been some legacy name and believed that net helpmsg was intended to work like Error Lookup. Hmmm, some new knowledge each entry.

    1. cheong00 says:

      “net” command has been a leftover of LAN Manager kit that provides you TCP/IP and file sharing functionality in DOS days. Therefore it has to get as many relevant functions into it as possible.

      And one of the things it provide is to help deciphering error code that it’s common to throw in the face of users in these days. In Win95 and later versions, it’s modified to query Windows instead of it’s internal string set, so it can return error message for other things too.

      So does “net accounts”, “net user” and “net group” because these are what you need in order to configure file sharing access rights.

      1. cheong00 says:

        Oh, there was no TCP/IP yet. All you get was IPX/SPX, or you could just say, networking. :)

  7. osexpert says:

    certutil /error 7
    0x7 (WIN32: 7) — 7 (7)
    Error message text: The storage control blocks were destroyed.

    That’s not nice.

  8. My favourite way of doing this is to fire up VS, attach native debugger to a random process, and type “errorcode,hr” into the watch window. For instance, “34,hr” shows this: ERROR_WRONG_DISK : The wrong diskette is in the drive. Insert %2 (Volume Serial Number: %3) into drive %1.

  9. Funny… I wasn’t aware of this, but I’ve been using for years the perror utility bundled with MySQL Server for this same purpose:

    C:\>perror 2
    OS error code 2: No such file or directory
    Win32 error code 2: El sistema no puede encontrar el archivo especificado.

    C:\>perror 8242
    Win32 error code 8242: Se ha especificado una sintaxis DN no válida.

    C:\>perror 34
    OS error code 34: Result too large

    C:\>perror 3871
    Illegal error code: 3871

Comments are closed.

Skip to main content