Error Messages

Header: winhttp.h

The error values listed below are returned by GetLastError when one of the Microsoft Windows HTTP Services (WinHTTP) functions fails, and are also returned in the lower 16 bits of HRESULT error returns from the WinHttpRequest 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.

SymbolicCodeDescription
ERROR_WINHTTP_AUTO_PROXY_SERVICE_ERROR12178Returned by [**WinHttpGetProxyForUrl**](/windows/desktop/api/Winhttp/nf-winhttp-winhttpgetproxyforurl) when a proxy for the specified URL cannot be located.
ERROR_WINHTTP_AUTODETECTION_FAILED12180Returned 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_SCRIPT12166An error occurred executing the script code in the Proxy Auto-Configuration (PAC) file.
ERROR_WINHTTP_CANNOT_CALL_AFTER_OPEN12103Returned 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_SEND12102Returned 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_OPEN12100Returned 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_SEND12101Returned by the [**HttpRequest**](winhttprequest.md) object if a requested operation cannot be performed before calling the [**Send**](iwinhttprequest-send.md) method.
ERROR_WINHTTP_CANNOT_CONNECT12029Returned if connection to the server failed.
ERROR_WINHTTP_CLIENT_AUTH_CERT_NEEDEDThe 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_KEYThe 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_KEYThe 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_OVERFLOW12183Returned by [**WinHttpReceiveResponse**](/windows/desktop/api/Winhttp/nf-winhttp-winhttpreceiveresponse) when an overflow condition is encountered in the course of parsing chunked encoding.
ERROR_WINHTTP_CONNECTION_ERROR12030The 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_EXISTS12155Obsolete; no longer used.
ERROR_WINHTTP_HEADER_COUNT_EXCEEDED12181Returned 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_FOUND12150The requested header cannot be located.
ERROR_WINHTTP_HEADER_SIZE_OVERFLOW12182Returned 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_STATE12019The requested operation cannot be carried out because the handle supplied is not in the correct state.
ERROR_WINHTTP_INCORRECT_HANDLE_TYPE12018The type of handle supplied is incorrect for this operation.
ERROR_WINHTTP_INTERNAL_ERROR12004An internal error has occurred.
ERROR_WINHTTP_INVALID_OPTION12009A 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_REQUEST12154Obsolete; no longer used.
ERROR_WINHTTP_INVALID_SERVER_RESPONSE12152The server response cannot be parsed.
ERROR_WINHTTP_INVALID_URL12005The URL is not valid.
ERROR_WINHTTP_LOGIN_FAILURE12015The 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_RESOLVED12007The server name cannot be resolved.
ERROR_WINHTTP_NOT_INITIALIZED12172Obsolete; no longer used.
ERROR_WINHTTP_OPERATION_CANCELLED12017The operation was canceled, usually because the handle on which the request was operating was closed before the operation completed.
ERROR_WINHTTP_OPTION_NOT_SETTABLE12011The requested option cannot be set, only queried.
ERROR_WINHTTP_OUT_OF_HANDLES12001Obsolete; no longer used.
ERROR_WINHTTP_REDIRECT_FAILED12156The redirection failed because either the scheme changed or all attempts made to redirect failed (default is five attempts).
ERROR_WINHTTP_RESEND_REQUEST12032The WinHTTP function failed. The desired function can be retried on the same request handle.
ERROR_WINHTTP_RESPONSE_DRAIN_OVERFLOW12184Returned when an incoming response exceeds an internal WinHTTP size limit.
ERROR_WINHTTP_SCRIPT_EXECUTION_ERROR12177An error was encountered while executing a script.
ERROR_WINHTTP_SECURE_CERT_CN_INVALID12038Returned 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_INVALID12037Indicates 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_FAILED12057Indicates that revocation cannot be checked because the revocation server was offline (equivalent to **CRYPT_E_REVOCATION_OFFLINE**).
ERROR_WINHTTP_SECURE_CERT_REVOKED12170Indicates that a certificate has been revoked (equivalent to **CRYPT_E_REVOKED**).
ERROR_WINHTTP_SECURE_CERT_WRONG_USAGE12179Indicates that a certificate is not valid for the requested usage (equivalent to **CERT_E_WRONG_USAGE**).
ERROR_WINHTTP_SECURE_CHANNEL_ERROR12157Indicates 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_FAILURE12175One 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_CA12045Indicates 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_CERT12169Indicates 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_SHUTDOWN12012The WinHTTP function support is being shut down or unloaded.
ERROR_WINHTTP_TIMEOUT12002The 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_SCRIPT12167The 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_TYPE12176The script type is not supported.
ERROR_WINHTTP_UNRECOGNIZED_SCHEME12006The URL specified a scheme other than "http:" or "https:".
ERROR_NOT_ENOUGH_MEMORYNot enough memory was available to complete the requested operation. **Header:** Declared in Winerror.h
ERROR_INSUFFICIENT_BUFFERThe 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_HANDLEThe handle passed to the application programming interface (API) has been either invalidated or closed. **Header:** Declared in Winerror.h
ERROR_NO_MORE_FILESNo more files have been found. **Header:** Declared in Winerror.h
ERROR_NO_MORE_ITEMSNo more items have been found. **Header:** Declared in Winerror.h
ERROR_NOT_SUPPORTEDThe required protocol stack is not loaded and the application cannot start WinSock. **Header:** Declared in Winerror.h
54 entries

Article text from the Win32 documentation (opens in a new tab), by Microsoft, under the CC BY 4.0 (opens in a new tab) licence.