Monday, November 26, 2007

What does that error code mean?

If you've ever come across an error number in managed code it can be infuriatingly difficult to find out the true root cause of your problem: normally there's a helpful wrapper around the numbers, giving (semi) meaningful names to the errors encountered.

But, work with stuff long enough and you'll soon find a huge, dirty-looking (mostly negative) integer staring back at you in your log files or debugger window and you'll wonder "What the **** does that mean?"

If you can't find anything on Google for the exact number you've got, paste the number into calc and convert it to hex. You'll usually get a number preceded by a bunch of Fs, which you can ignore. Do another search for this hex number (minus the Fs), and you'll sometimes get something which will point you in the right direction.

It was on such a search where I stumbled across this helpful document. This text file contains a heap of hex error codes and their meanings. judging by the ntstatus.txt file name they look to date back to Windows NT days, but they're still helpful now in some cases.

I can't say that everything in there is accurate, or that every error code you'll get is listed there.

1 comment:

Paul Hallam said...


The errors are a particular instance of COM error codes or SCODES which are 32 bit values on 16-bit in which the high-order bit is on for error and clear for success - for details see
Bits 16-19 are known as the facility code which indicates what has produced the error - and where this is 7 that indicates the source is a Win32 API.
To find out the cause look at the value in the first 16 bits. Thus 0x80070005 is Win32 error code 5 or Access Denied.
NT to Win32 error code mapping is explained in
A real neat way of getting the message for a Win32 error code is to run 'net helpmsg w32errocode' at a command prompt.