Repository: stable-diffusion-webui
Issue: [Bug]: WebUI running error. OSError: [WinError 10049] The requested address is invalid in this context.
Labels: asking-for-help-with-local-system-issues

### Is there an existing issue for this?

- [X] I have searched the existing issues and checked the recent builds/commits

### What happened?

For some reason, when I run the webui, I get an error and it won't run.

### Steps to reproduce the problem

1. run webui-user.bat


### What should have happened?

show webui homepage

### Version or Commit where the problem happens

v1.5.1

### What Python version are you running on ?

Python 3.10.x

### What platforms do you use to access the UI ?

Windows

### What device are you running WebUI on?

Nvidia GPUs (RTX 20 above)

### Cross attention optimization

Automatic

### What browsers do you use to access the UI ?

Brave

### Command Line Arguments

```Shell
set COMMANDLINE_ARGS=--xformers --opt-sdp-attention --autolaunch --listen --theme dark
set TORCH_COMMAND=pip install --pre torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu118
```


### List of extensions

a1111-sd-webui-tagcomplete
adetailer
ddetailer
multidiffusion-upscaler-for-automatic1111
sd-webui-controlnet
Stable-Diffusion-Webui-Civitai-Helper

### Console logs

```Shell
Launching Web UI with arguments: --xformers --opt-sdp-attention --autolaunch --listen --theme dark
Civitai Helper: Get Custom Model Folder
Civitai Helper: Load setting from: C:\Users\dev_i\Desktop\stable-diffusion-webui\extensions\Stable-Diffusion-Webui-Civitai-Helper\setting.json
Civitai Helper: No setting file, use default
Tag Autocomplete: Could not locate model-keyword extension, Lora trigger word completion will be limited to those added through the extra networks menu.
[-] ADetailer initialized. version: 23.7.11, num models: 9
2023-08-13 17:53:07,743 - ControlNet - INFO - ControlNet v1.1.234
ControlNet preprocessor location: C:\Users\dev_i\Desktop\stable-diffusion-webui\extensions\sd-webui-controlnet\annotator\downloads
2023-08-13 17:53:07,800 - ControlNet - INFO - ControlNet v1.1.234
Loading weights [70d91bdd38] from C:\Users\dev_i\Desktop\stable-diffusion-webui\models\Stable-diffusion\cuteyukimixAdorable_echodimension.safetensors
Creating model from config: C:\Users\dev_i\Desktop\stable-diffusion-webui\configs\v1-inference.yaml
LatentDiffusion: Running in eps-prediction mode
DiffusionWrapper has 859.52 M params.
Loading VAE weights specified in settings: C:\Users\dev_i\Desktop\stable-diffusion-webui\models\VAE\kl-f8-anime2.ckpt
Applying attention optimization: xformers... done.
Model loaded in 2.6s (load weights from disk: 0.5s, load config: 0.2s, create model: 0.3s, apply weights to model: 0.4s, apply half(): 0.4s, load VAE: 0.1s, move model to device: 0.7s).
╭─────────────────────────────── Traceback (most recent call last) ────────────────────────────────╮
│ C:\Users\dev_i\Desktop\stable-diffusion-webui\venv\lib\site-packages\urllib3\connection.py:203   │
│ in _new_conn                                                                                     │
│                                                                                                  │
│   200 │   │   :return: New socket connection.                                                    │
│   201 │   │   """                                                                                │
│   202 │   │   try:                                                                               │
│ ❱ 203 │   │   │   sock = connection.create_connection(                                           │
│   204 │   │   │   │   (self._dns_host, self.port),                                               │
│   205 │   │   │   │   self.timeout,                                                              │
│   206 │   │   │   │   source_address=self.source_address,                                        │
│                                                                                                  │
│ C:\Users\dev_i\Desktop\stable-diffusion-webui\venv\lib\site-packages\urllib3\util\connection.py: │
│ 85 in create_connection                                                                          │
│                                                                                                  │
│    82 │                                                                                          │
│    83 │   if err is not None:                                                                    │
│    84 │   │   try:                                                                               │
│ ❱  85 │   │   │   raise err                                                                      │
│    86 │   │   finally:                                                                           │
│    87 │   │   │   # Break explicitly a reference cycle                                           │
│    88 │   │   │   err = None                                                                     │
│                                                                                                  │
│ C:\Users\dev_i\Desktop\stable-diffusion-webui\venv\lib\site-packages\urllib3\util\connection.py: │
│ 73 in create_connection                                                                          │
│                                                                                                  │
│    70 │   │   │   │   sock.settimeout(timeout)                                                   │
│    71 │   │   │   if source_address:                                                             │
│    72 │   │   │   │   sock.bind(source_address)                                                  │
│ ❱  73 │   │   │   sock.connect(sa)                                                               │
│    74 │   │   │   # Break explicitly a reference cycle                                           │
│    75 │   │   │   err = None                                                                     │
│    76 │   │   │   return sock                                                                    │
╰──────────────────────────────────────────────────────────────────────────────────────────────────╯
OSError: [WinError 10049] The requested address is invalid in this context

The above exception was the direct cause of the following exception:

╭─────────────────────────────── Traceback (most recent call last) ────────────────────────────────╮
│ C:\Users\dev_i\Desktop\stable-diffusion-webui\venv\lib\site-packages\urllib3\connectionpool.py:7 │
│ 90 in urlopen                                                                                    │
│                                                                                                  │
│    787 │   │   │   response_conn = conn if not release_conn else None                            │
│    788 │   │   │                                                                                 │
│    789 │   │   │   # Make the request on the HTTPConnection object                               │
│ ❱  790 │   │   │   response = self._make_request(                                                │
│    791 │   │   │   │   conn,                                                                     │
│    792 │   │   │   │   method,                                                                   │
│    793 │   │   │   │   url,                                                                      │
│                                                                                                  │
│ C:\Users\dev_i\Desktop\stable-diffusion-webui\venv\lib\site-packages\urllib3\connectionpool.py:4 │
│ 96 in _make_request                                                                              │
│                                                                                                  │
│    493 │   │   # conn.request() calls http.client.*.request, not the method in                   │
│    494 │   │   # urllib3.request. It also calls makefile (recv) on the socket.                   │
│    495 │   │   try:                                                                              │
│ ❱  496 │   │   │   conn.request(                                                                 │
│    497 │   │   │   │   method,                                                                   │
│    498 │   │   │   │   url,                                                                      │
│    499 │   │   │   │   body=body,                                                                │
│                                                                                                  │
│ C:\Users\dev_i\Desktop\stable-diffusion-webui\venv\lib\site-packages\urllib3\connection.py:395   │
│ in request                                                                                       │
│                                                                                                  │
│   392 │   │   │   self.putheader("User-Agent", _get_default_user_agent())                        │
│   393 │   │   for header, value in headers.items():                                              │
│   394 │   │   │   self.putheader(header, value)                                                  │
│ ❱ 395 │   │   self.endheaders()                                                                  │
│   396 │   │                                                                                      │
│   397 │   │   # If we're given a body we start sending that in chunks.                           │
│   398 │   │   if chunks is not None:                                                             │
│                                                                                                  │
│ C:\Program Files\Python310\lib\http\client.py:1277 in endheaders                                 │
│                                                                                                  │
│   1274 │   │   │   self.__state = _CS_REQ_SENT                                                   │
│   1275 │   │   else:                                                                             │
│   1276 │   │   │   raise CannotSendHeader()                                                      │
│ ❱ 1277 │   │   self._send_output(message_body, encode_chunked=encode_chunked)                    │
│   1278 │                                                                                         │
│   1279 │   def request(self, method, url, body=None, headers={}, *,                              │
│   1280 │   │   │   │   encode_chunked=False):                                                    │
│                                                                                                  │
│ C:\Program Files\Python310\lib\http\client.py:1037 in _send_output                               │
│                                                                                                  │
│   1034 │   │   self._buffer.extend((b"", b""))                                                   │
│   1035 │   │   msg = b"\r\n".join(self._buffer)                                                  │
│   1036 │   │   del self._buffer[:]                                                               │
│ ❱ 1037 │   │   self.send(msg)                                                                    │
│   1038 │   │                                                                                     │
│   1039 │   │   if message_body is not None:                                                      │
│   1040                                                                                           │
│                                                                                                  │
│ C:\Program Files\Python310\lib\http\client.py:975 in send                                        │
│                                                                                                  │
│    972 │   │                                                                                     │
│    973 │   │   if self.sock is None:                                                             │
│    974 │   │   │   if self.auto_open:                                                            │
│ ❱  975 │   │   │   │   self.connect()                                                            │
│    976 │   │   │   else:                                                                         │
│    977 │   │   │   │   raise NotConnected()                                                      │
│    978                                                                                           │
│                                                                                                  │
│ C:\Users\dev_i\Desktop\stable-diffusion-webui\venv\lib\site-packages\urllib3\connection.py:243   │
│ in connect                                                                                       │
│                                                                                                  │
│   240 │   │   self._tunnel_scheme = scheme                                                       │
│   241 │                                                                                          │
│   242 │   def connect(self) -> None:                                                             │
│ ❱ 243 │   │   self.sock = self._new_conn()                                                       │
│   244 │   │   if self._tunnel_host:                                                              │
│   245 │   │   │   # If we're tunneling it means we're connected to our proxy.                    │
│   246 │   │   │   self._has_connected_to_proxy = True                                            │
│                                                                                                  │
│ C:\Users\dev_i\Desktop\stable-diffusion-webui\venv\lib\site-packages\urllib3\connection.py:218   │
│ in _new_conn                                                                                     │
│                                                                                                  │
│   215 │   │   │   ) from e                                                                       │
│   216 │   │                                                                                      │
│   217 │   │   except OSError as e:                                                               │
│ ❱ 218 │   │   │   raise NewConnectionError(                                                      │
│   219 │   │   │   │   self, f"Failed to establish a new connection: {e}"                         │
│   220 │   │   │   ) from e                                                                       │
│   221                                                                                            │
╰──────────────────────────────────────────────────────────────────────────────────────────────────╯
NewConnectionError: <urllib3.connection.HTTPConnection object at 0x00000230E4C0E290>: Failed to establish a new
connection: [WinError 10049] The requested address is invalid in this context

The above exception was the direct cause of the following exception:

╭─────────────────────────────── Traceback (most recent call last) ────────────────────────────────╮
│ C:\Users\dev_i\Desktop\stable-diffusion-webui\venv\lib\site-packages\requests\adapters.py:486 in │
│ send                                                                                             │
│                                                                                                  │
│   483 │   │   │   timeout = TimeoutSauce(connect=timeout, read=timeout)                          │
│   484 │   │                                                                                      │
│   485 │   │   try:                                                                               │
│ ❱ 486 │   │   │   resp = conn.urlopen(                                                           │
│   487 │   │   │   │   method=request.method,                                                     │
│   488 │   │   │   │   url=url,                                                                   │
│   489 │   │   │   │   body=request.body,                                                         │
│                                                                                                  │
│ C:\Users\dev_i\Desktop\stable-diffusion-webui\venv\lib\site-packages\urllib3\connectionpool.py:8 │
│ 44 in urlopen                                                                                    │
│                                                                                                  │
│    841 │   │   │   elif isinstance(new_e, (OSError, HTTPException)):                             │
│    842 │   │   │   │   new_e = ProtocolError("Connection aborted.", new_e)                       │
│    843 │   │   │                                                                                 │
│ ❱  844 │   │   │   retries = retries.increment(                                                  │
│    845 │   │   │   │   method, url, error=new_e, _pool=self, _stacktrace=sys.exc_info()[2]       │
│    846 │   │   │   )                                                                             │
│    847 │   │   │   retries.sleep()                                                               │
│                                                                                                  │
│ C:\Users\dev_i\Desktop\stable-diffusion-webui\venv\lib\site-packages\urllib3\util\retry.py:515   │
│ in increment                                                                                     │
│                                                                                                  │
│   512 │   │                                                                                      │
│   513 │   │   if new_retry.is_exhausted():                                                       │
│   514 │   │   │   reason = error or ResponseError(cause)                                         │
│ ❱ 515 │   │   │   raise MaxRetryError(_pool, url, reason) from reason  # type: ignore[arg-type   │
│   516 │   │                                                                                      │
│   517 │   │   log.debug("Incremented Retry for (url='%s'): %r", url, new_retry)                  │
│   518                                                                                            │
╰──────────────────────────────────────────────────────────────────────────────────────────────────╯
MaxRetryError: HTTPConnectionPool(host='localhost', port=7860): Max retries exceeded with url: /startup-events (Caused
by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x00000230E4C0E290>: Failed to establish a new
connection: [WinError 10049] The requested address is invalid in this context'))

During handling of the above exception, another exception occurred:

╭─────────────────────────────── Traceback (most recent call last) ────────────────────────────────╮
│ C:\Users\dev_i\Desktop\stable-diffusion-webui\launch.py:39 in <module>                           │
│                                                                                                  │
│   36                                                                                             │
│   37                                                                                             │
│   38 if __name__ == "__main__":                                                                  │
│ ❱ 39 │   main()                                                                                  │
│   40                                                                                             │
│                                                                                                  │
│ C:\Users\dev_i\Desktop\stable-diffusion-webui\launch.py:35 in main                               │
│                                                                                                  │
│   32 │   if args.test_server:                                                                    │
│   33 │   │   configure_for_tests()                                                               │
│   34 │                                                                                           │
│ ❱ 35 │   start()                                                                                 │
│   36                                                                                             │
│   37                                                                                             │
│   38 if __name__ == "__main__":                                                                  │
│                                                                                                  │
│ C:\Users\dev_i\Desktop\stable-diffusion-webui\modules\launch_utils.py:394 in start               │
│                                                                                                  │
│   391 │   if '--nowebui' in sys.argv:                                                            │
│   392 │   │   webui.api_only()                                                                   │
│   393 │   else:                                                                                  │
│ ❱ 394 │   │   webui.webui()                                                                      │
│   395                                                                                            │
│                                                                                                  │
│ C:\Users\dev_i\Desktop\stable-diffusion-webui\webui.py:401 in webui                              │
│                                                                                                  │
│   398 │   │                                                                                      │
│   399 │   │   gradio_auth_creds = list(get_gradio_auth_creds()) or None                          │
│   400 │   │                                                                                      │
│ ❱ 401 │   │   app, local_url, share_url = shared.demo.launch(                                    │
│   402 │   │   │   share=cmd_opts.share,                                                          │
│   403 │   │   │   server_name=server_name,                                                       │
│   404 │   │   │   server_port=cmd_opts.port,                                                     │
│                                                                                                  │
│ C:\Users\dev_i\Desktop\stable-diffusion-webui\venv\lib\site-packages\gradio\blocks.py:1775 in    │
│ launch                                                                                           │
│                                                                                                  │
│   1772 │   │   │                                                                                 │
│   1773 │   │   │   # Cannot run async functions in background other than app's scope.            │
│   1774 │   │   │   # Workaround by triggering the app endpoint                                   │
│ ❱ 1775 │   │   │   requests.get(f"{self.local_url}startup-events", verify=ssl_verify)            │
│   1776 │   │                                                                                     │
│   1777 │   │   utils.launch_counter()                                                            │
│   1778                                                                                           │
│                                                                                                  │
│ C:\Users\dev_i\Desktop\stable-diffusion-webui\venv\lib\site-packages\requests\api.py:73 in get   │
│                                                                                                  │
│    70 │   :rtype: requests.Response                                                              │
│    71 │   """                                                                                    │
│    72 │                                                                                          │
│ ❱  73 │   return request("get", url, params=params, **kwargs)                                    │
│    74                                                                                            │
│    75                                                                                            │
│    76 def options(url, **kwargs):                                                                │
│                                                                                                  │
│ C:\Users\dev_i\Desktop\stable-diffusion-webui\venv\lib\site-packages\requests\api.py:59 in       │
│ request                                                                                          │
│                                                                                                  │
│    56 │   # avoid leaving sockets open which can trigger a ResourceWarning in some               │
│    57 │   # cases, and look like a memory leak in others.                                        │
│    58 │   with sessions.Session() as session:                                                    │
│ ❱  59 │   │   return session.request(method=method, url=url, **kwargs)                           │
│    60                                                                                            │
│    61                                                                                            │
│    62 def get(url, params=None, **kwargs):                                                       │
│                                                                                                  │
│ C:\Users\dev_i\Desktop\stable-diffusion-webui\venv\lib\site-packages\requests\sessions.py:589 in │
│ request                                                                                          │
│                                                                                                  │
│   586 │   │   │   "allow_redirects": allow_redirects,                                            │
│   587 │   │   }                                                                                  │
│   588 │   │   send_kwargs.update(settings)                                                       │
│ ❱ 589 │   │   resp = self.send(prep, **send_kwargs)                                              │
│   590 │   │                                                                                      │
│   591 │   │   return resp                                                                        │
│   592                                                                                            │
│                                                                                                  │
│ C:\Users\dev_i\Desktop\stable-diffusion-webui\venv\lib\site-packages\requests\sessions.py:703 in │
│ send                                                                                             │
│                                                                                                  │
│   700 │   │   start = preferred_clock()                                                          │
│   701 │   │                                                                                      │
│   702 │   │   # Send the request                                                                 │
│ ❱ 703 │   │   r = adapter.send(request, **kwargs)                                                │
│   704 │   │                                                                                      │
│   705 │   │   # Total elapsed time of the request (approximately)                                │
│   706 │   │   elapsed = preferred_clock() - start                                                │
│                                                                                                  │
│ C:\Users\dev_i\Desktop\stable-diffusion-webui\venv\lib\site-packages\requests\adapters.py:519 in │
│ send                                                                                             │
│                                                                                                  │
│   516 │   │   │   │   # This branch is for urllib3 v1.22 and later.                              │
│   517 │   │   │   │   raise SSLError(e, request=request)                                         │
│   518 │   │   │                                                                                  │
│ ❱ 519 │   │   │   raise ConnectionError(e, request=request)                                      │
│   520 │   │                                                                                      │
│   521 │   │   except ClosedPoolError as e:                                                       │
│   522 │   │   │   raise ConnectionError(e, request=request)                                      │
╰──────────────────────────────────────────────────────────────────────────────────────────────────╯
ConnectionError: HTTPConnectionPool(host='localhost', port=7860): Max retries exceeded with url: /startup-events (Caused
by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x00000230E4C0E290>: Failed to establish a new
connection: [WinError 10049] The requested address is invalid in this context'))
```


### Additional information

_No response_