--- description: The error values identified in this topic are returned by GetLastError when one of the Microsoft Windows HTTP Services (WinHTTP) functions fails. ms.assetid: c8a863cd-d36c-4ec8-ac49-0b714a5e4cc2 title: Error Messages (Winhttp.h) ms.topic: reference ms.date: 05/31/2018 --- # Error Messages (Winhttp.h) The error values listed below are returned by [**GetLastError**](/windows/desktop/api/errhandlingapi/nf-errhandlingapi-getlasterror) when one of the Microsoft Windows HTTP Services (WinHTTP) functions fails, and are also returned in the lower 16 bits of [**HRESULT**](../com/structure-of-com-error-codes.md) error returns from the [**WinHttpRequest**](winhttprequest.md) object. Error values whose names begin with "ERROR\_WINHTTP\_" are specific to the WinHTTP functions. The WinHTTP functions also return Windows error messages where appropriate.
**ERROR\_WINHTTP\_AUTO\_PROXY\_SERVICE\_ERROR**
12178
Returned by [**WinHttpGetProxyForUrl**](/windows/desktop/api/Winhttp/nf-winhttp-winhttpgetproxyforurl) when a proxy for the specified URL cannot be located.
**ERROR\_WINHTTP\_AUTODETECTION\_FAILED**
12180
Returned by [**WinHttpDetectAutoProxyConfigUrl**](/windows/desktop/api/Winhttp/nf-winhttp-winhttpdetectautoproxyconfigurl) if WinHTTP was unable to discover the URL of the Proxy Auto-Configuration (PAC) file.
**ERROR\_WINHTTP\_BAD\_AUTO\_PROXY\_SCRIPT**
12166
An error occurred executing the script code in the Proxy Auto-Configuration (PAC) file.
**ERROR\_WINHTTP\_CANNOT\_CALL\_AFTER\_OPEN**
12103
Returned by the [**HttpRequest**](winhttprequest.md) object if a specified option cannot be requested after the [**Open**](iwinhttprequest-open.md) method has been called.
**ERROR\_WINHTTP\_CANNOT\_CALL\_AFTER\_SEND**
12102
Returned by the [**HttpRequest**](winhttprequest.md) object if a requested operation cannot be performed after calling the [**Send**](iwinhttprequest-send.md) method.
**ERROR\_WINHTTP\_CANNOT\_CALL\_BEFORE\_OPEN**
12100
Returned by the [**HttpRequest**](winhttprequest.md) object if a requested operation cannot be performed before calling the [**Open**](iwinhttprequest-open.md) method.
**ERROR\_WINHTTP\_CANNOT\_CALL\_BEFORE\_SEND**
12101
Returned by the [**HttpRequest**](winhttprequest.md) object if a requested operation cannot be performed before calling the [**Send**](iwinhttprequest-send.md) method.
**ERROR\_WINHTTP\_CANNOT\_CONNECT**
12029
Returned if connection to the server failed.
**ERROR\_WINHTTP\_CLIENT\_AUTH\_CERT\_NEEDED**
The server requires SSL client Authentication. The application retrieves the list of certificate issuers by calling [**WinHttpQueryOption**](/windows/desktop/api/Winhttp/nf-winhttp-winhttpqueryoption) with the **WINHTTP\_OPTION\_CLIENT\_CERT\_ISSUER\_LIST** option. For more information, see the **WINHTTP\_OPTION\_CLIENT\_CERT\_ISSUER\_LIST** option. If the server requests the client certificate, but does not require it, the application can alternately call [**WinHttpSetOption**](/windows/desktop/api/Winhttp/nf-winhttp-winhttpsetoption) with the **WINHTTP\_OPTION\_CLIENT\_CERT\_CONTEXT** option. In this case, the application specifies the WINHTTP\_NO\_CLIENT\_CERT\_CONTEXT macro in the *lpBuffer* parameter of **WinHttpSetOption**. For more information, see the **WINHTTP\_OPTION\_CLIENT\_CERT\_CONTEXT** option. **Windows Server 2003 with SP1 and Windows XP with SP2:** This error is not supported.
**ERROR\_WINHTTP\_CLIENT\_CERT\_NO\_ACCESS\_PRIVATE\_KEY**
The application does not have the required privileges to access the private key associated with the client certificate. **Windows Server 2003 with SP1 and Windows XP with SP2:** This error is not supported.
**ERROR\_WINHTTP\_CLIENT\_CERT\_NO\_PRIVATE\_KEY**
The context for the SSL client certificate does not have a private key associated with it. The client certificate may have been imported to the computer without the private key. **Windows Server 2003 with SP1 and Windows XP with SP2:** This error is not supported.
**ERROR\_WINHTTP\_CHUNKED\_ENCODING\_HEADER\_SIZE\_OVERFLOW**
12183
Returned by [**WinHttpReceiveResponse**](/windows/desktop/api/Winhttp/nf-winhttp-winhttpreceiveresponse) when an overflow condition is encountered in the course of parsing chunked encoding.
**ERROR\_WINHTTP\_CLIENT\_AUTH\_CERT\_NEEDED**
12044
Returned by [**WinHttpReceiveResponse**](/windows/desktop/api/Winhttp/nf-winhttp-winhttpreceiveresponse) when the server requests client authentication. **Windows Server 2003 with SP1 and Windows XP with SP2:** This error is not supported.
**ERROR\_WINHTTP\_CONNECTION\_ERROR**
12030
The connection with the server has been reset or terminated, or an incompatible SSL protocol was encountered. For example, WinHTTP version 5.1 does not support SSL2 unless the client specifically enables it.
**ERROR\_WINHTTP\_HEADER\_ALREADY\_EXISTS**
12155
Obsolete; no longer used.
**ERROR\_WINHTTP\_HEADER\_COUNT\_EXCEEDED**
12181
Returned by [**WinHttpReceiveResponse**](/windows/desktop/api/Winhttp/nf-winhttp-winhttpreceiveresponse) when a larger number of headers were present in a response than WinHTTP could receive.
**ERROR\_WINHTTP\_HEADER\_NOT\_FOUND**
12150
The requested header cannot be located.
**ERROR\_WINHTTP\_HEADER\_SIZE\_OVERFLOW**
12182
Returned by [**WinHttpReceiveResponse**](/windows/desktop/api/Winhttp/nf-winhttp-winhttpreceiveresponse) when the size of headers received exceeds the limit for the request handle.
**ERROR\_WINHTTP\_INCORRECT\_HANDLE\_STATE**
12019
The requested operation cannot be carried out because the handle supplied is not in the correct state.
**ERROR\_WINHTTP\_INCORRECT\_HANDLE\_TYPE**
12018
The type of handle supplied is incorrect for this operation.
**ERROR\_WINHTTP\_INTERNAL\_ERROR**
12004
An internal error has occurred.
**ERROR\_WINHTTP\_INVALID\_OPTION**
12009
A request to [**WinHttpQueryOption**](/windows/desktop/api/Winhttp/nf-winhttp-winhttpqueryoption) or [**WinHttpSetOption**](/windows/desktop/api/Winhttp/nf-winhttp-winhttpsetoption) specified an invalid option value.
**ERROR\_WINHTTP\_INVALID\_QUERY\_REQUEST**
12154
Obsolete; no longer used.
**ERROR\_WINHTTP\_INVALID\_SERVER\_RESPONSE**
12152
The server response cannot be parsed.
**ERROR\_WINHTTP\_INVALID\_URL**
12005
The URL is not valid.
**ERROR\_WINHTTP\_LOGIN\_FAILURE**
12015
The login attempt failed. When this error is encountered, the request handle should be closed with [**WinHttpCloseHandle**](/windows/desktop/api/Winhttp/nf-winhttp-winhttpclosehandle). A new request handle must be created before retrying the function that originally produced this error.
**ERROR\_WINHTTP\_NAME\_NOT\_RESOLVED**
12007
The server name cannot be resolved.
**ERROR\_WINHTTP\_NOT\_INITIALIZED**
12172
Obsolete; no longer used.
**ERROR\_WINHTTP\_OPERATION\_CANCELLED**
12017
The operation was canceled, usually because the handle on which the request was operating was closed before the operation completed.
**ERROR\_WINHTTP\_OPTION\_NOT\_SETTABLE**
12011
The requested option cannot be set, only queried.
**ERROR\_WINHTTP\_OUT\_OF\_HANDLES**
12001
Obsolete; no longer used.
**ERROR\_WINHTTP\_REDIRECT\_FAILED**
12156
The redirection failed because either the scheme changed or all attempts made to redirect failed (default is five attempts).
**ERROR\_WINHTTP\_RESEND\_REQUEST**
12032
The WinHTTP function failed. The desired function can be retried on the same request handle.
**ERROR\_WINHTTP\_RESPONSE\_DRAIN\_OVERFLOW**
12184
Returned when an incoming response exceeds an internal WinHTTP size limit.
**ERROR\_WINHTTP\_SCRIPT\_EXECUTION\_ERROR**
12177
An error was encountered while executing a script.
**ERROR\_WINHTTP\_SECURE\_CERT\_CN\_INVALID**
12038
Returned when a certificate CN name does not match the passed value (equivalent to a **CERT\_E\_CN\_NO\_MATCH** error).
**ERROR\_WINHTTP\_SECURE\_CERT\_DATE\_INVALID**
12037
Indicates that a required certificate is not within its validity period when verifying against the current system clock or the timestamp in the signed file, or that the validity periods of the certification chain do not nest correctly (equivalent to a **CERT\_E\_EXPIRED** or a **CERT\_E\_VALIDITYPERIODNESTING** error).
**ERROR\_WINHTTP\_SECURE\_CERT\_REV\_FAILED**
12057
Indicates that revocation cannot be checked because the revocation server was offline (equivalent to **CRYPT\_E\_REVOCATION\_OFFLINE**).
**ERROR\_WINHTTP\_SECURE\_CERT\_REVOKED**
12170
Indicates that a certificate has been revoked (equivalent to **CRYPT\_E\_REVOKED**).
**ERROR\_WINHTTP\_SECURE\_CERT\_WRONG\_USAGE**
12179
Indicates that a certificate is not valid for the requested usage (equivalent to **CERT\_E\_WRONG\_USAGE**).
**ERROR\_WINHTTP\_SECURE\_CHANNEL\_ERROR**
12157
Indicates that an error occurred having to do with a secure channel (equivalent to error codes that begin with "SEC\_E\_" and "SEC\_I\_" listed in the "winerror.h" header file).
**ERROR\_WINHTTP\_SECURE\_FAILURE**
12175
One or more errors were found in the Secure Sockets Layer (SSL) certificate sent by the server. To determine what type of error was encountered, check for a [**WINHTTP\_CALLBACK\_STATUS\_SECURE\_FAILURE**](/windows/win32/api/winhttp/nc-winhttp-winhttp_status_callback) notification in a status callback function. For more information, see [**WINHTTP\_STATUS\_CALLBACK**](/windows/win32/api/winhttp/nc-winhttp-winhttp_status_callback).
**ERROR\_WINHTTP\_SECURE\_INVALID\_CA**
12045
Indicates that a certificate chain was processed, but terminated in a root certificate that is not trusted by the trust provider (equivalent to **CERT\_E\_UNTRUSTEDROOT**).
**ERROR\_WINHTTP\_SECURE\_INVALID\_CERT**
12169
Indicates that a certificate is invalid (equivalent to errors such as **CERT\_E\_ROLE**, **CERT\_E\_PATHLENCONST**, **CERT\_E\_CRITICAL**, **CERT\_E\_PURPOSE**, **CERT\_E\_ISSUERCHAINING**, **CERT\_E\_MALFORMED** and **CERT\_E\_CHAINING**).
**ERROR\_WINHTTP\_SHUTDOWN**
12012
The WinHTTP function support is being shut down or unloaded.
**ERROR\_WINHTTP\_TIMEOUT**
12002
The request has timed out. This error can be returned as a result of TCP/IP time-out behavior, regardless of time-out values set in Windows HTTP Services.
**ERROR\_WINHTTP\_UNABLE\_TO\_DOWNLOAD\_SCRIPT**
12167
The PAC file cannot be downloaded. For example, the server referenced by the PAC URL may not have been reachable, or the server returned a 404 NOT FOUND response.
**ERROR\_WINHTTP\_UNHANDLED\_SCRIPT\_TYPE**
12176
The script type is not supported.
**ERROR\_WINHTTP\_UNRECOGNIZED\_SCHEME**
12006
The URL specified a scheme other than "http:" or "https:".
**ERROR\_NOT\_ENOUGH\_MEMORY**
Not enough memory was available to complete the requested operation. **Header:** Declared in Winerror.h
**ERROR\_INSUFFICIENT\_BUFFER**
The size, in bytes, of the buffer supplied to a function was insufficient to contain the returned data. For more information, see the specific function. **Header:** Declared in Winerror.h
**ERROR\_INVALID\_HANDLE**
The handle passed to the application programming interface (API) has been either invalidated or closed. **Header:** Declared in Winerror.h
**ERROR\_NO\_MORE\_FILES**
No more files have been found. **Header:** Declared in Winerror.h
**ERROR\_NO\_MORE\_ITEMS**
No more items have been found. **Header:** Declared in Winerror.h
**ERROR\_NOT\_SUPPORTED**
The required protocol stack is not loaded and the application cannot start WinSock. **Header:** Declared in Winerror.h
## Remarks For Windows XP and Windows 2000, see the [Run-Time Requirements](winhttp-start-page.md) section of the WinHttp start page. ## Requirements | Requirement | Value | |-------------------------------------|--------------------------------------------------------------------------------------------| | Minimum supported client
| Windows XP, Windows 2000 Professional with SP3 \[desktop apps only\]
| | Minimum supported server
| Windows Server 2003, Windows 2000 Server with SP3 \[desktop apps only\]
| | Redistributable
| WinHTTP 5.0 and Internet Explorer 5.01 or later on Windows XP and Windows 2000.
| | Header
|
Winhttp.h
| ## See also
[WinHTTP Versions](winhttp-versions.md)