stable-diffusion-webui icon indicating copy to clipboard operation
stable-diffusion-webui copied to clipboard

[Bug]: List index out of range

Open Woisek opened this issue 1 year ago • 12 comments

Is there an existing issue for this?

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

What happened?

Everytime the WebUI is reloaded, this error occurs

Steps to reproduce the problem

  1. Klick "Reload UI"

What should have happened?

Nothing, besides a reloaded UI.

Commit where the problem happens

https://github.com/AUTOMATIC1111/stable-diffusion-webui/commit/0cc0ee1bcb4c24a8c9715f66cede06601bfc00c8

What platforms do you use to access the UI ?

Windows

What browsers do you use to access the UI ?

Mozilla Firefox

Command Line Arguments

--xformers --api --administrator --opt-split-attention --theme=dark

List of extensions

Too much to mention

Console logs

To create a public link, set `share=True` in `launch()`.
ERROR:    Exception in ASGI application
Traceback (most recent call last):
  File "I:\Super SD 2.0\stable-diffusion-webui\venv\lib\site-packages\anyio\streams\memory.py", line 94, in receive
    return self.receive_nowait()
  File "I:\Super SD 2.0\stable-diffusion-webui\venv\lib\site-packages\anyio\streams\memory.py", line 89, in receive_nowait
    raise WouldBlock
anyio.WouldBlock

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "I:\Super SD 2.0\stable-diffusion-webui\venv\lib\site-packages\starlette\middleware\base.py", line 77, in call_next
    message = await recv_stream.receive()
  File "I:\Super SD 2.0\stable-diffusion-webui\venv\lib\site-packages\anyio\streams\memory.py", line 114, in receive
    raise EndOfStream
anyio.EndOfStream

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "I:\Super SD 2.0\stable-diffusion-webui\venv\lib\site-packages\uvicorn\protocols\http\h11_impl.py", line 407, in run_asgi
    result = await app(  # type: ignore[func-returns-value]
  File "I:\Super SD 2.0\stable-diffusion-webui\venv\lib\site-packages\uvicorn\middleware\proxy_headers.py", line 78, in __call__
    return await self.app(scope, receive, send)
  File "I:\Super SD 2.0\stable-diffusion-webui\venv\lib\site-packages\fastapi\applications.py", line 271, in __call__
    await super().__call__(scope, receive, send)
  File "I:\Super SD 2.0\stable-diffusion-webui\venv\lib\site-packages\starlette\applications.py", line 125, in __call__
    await self.middleware_stack(scope, receive, send)
  File "I:\Super SD 2.0\stable-diffusion-webui\venv\lib\site-packages\starlette\middleware\errors.py", line 184, in __call__
    raise exc
  File "I:\Super SD 2.0\stable-diffusion-webui\venv\lib\site-packages\starlette\middleware\errors.py", line 162, in __call__
    await self.app(scope, receive, _send)
  File "I:\Super SD 2.0\stable-diffusion-webui\venv\lib\site-packages\starlette\middleware\base.py", line 104, in __call__
    response = await self.dispatch_func(request, call_next)
  File "I:\Super SD 2.0\stable-diffusion-webui\modules\api\api.py", line 96, in log_and_time
    res: Response = await call_next(req)
  File "I:\Super SD 2.0\stable-diffusion-webui\venv\lib\site-packages\starlette\middleware\base.py", line 80, in call_next
    raise app_exc
  File "I:\Super SD 2.0\stable-diffusion-webui\venv\lib\site-packages\starlette\middleware\base.py", line 69, in coro
    await self.app(scope, receive_or_disconnect, send_no_error)
  File "I:\Super SD 2.0\stable-diffusion-webui\venv\lib\site-packages\starlette\middleware\gzip.py", line 24, in __call__
    await responder(scope, receive, send)
  File "I:\Super SD 2.0\stable-diffusion-webui\venv\lib\site-packages\starlette\middleware\gzip.py", line 44, in __call__
    await self.app(scope, receive, self.send_with_gzip)
  File "I:\Super SD 2.0\stable-diffusion-webui\venv\lib\site-packages\starlette\middleware\exceptions.py", line 79, in __call__
    raise exc
  File "I:\Super SD 2.0\stable-diffusion-webui\venv\lib\site-packages\starlette\middleware\exceptions.py", line 68, in __call__
    await self.app(scope, receive, sender)
  File "I:\Super SD 2.0\stable-diffusion-webui\venv\lib\site-packages\fastapi\middleware\asyncexitstack.py", line 21, in __call__
    raise e
  File "I:\Super SD 2.0\stable-diffusion-webui\venv\lib\site-packages\fastapi\middleware\asyncexitstack.py", line 18, in __call__
    await self.app(scope, receive, send)
  File "I:\Super SD 2.0\stable-diffusion-webui\venv\lib\site-packages\starlette\routing.py", line 706, in __call__
    await route.handle(scope, receive, send)
  File "I:\Super SD 2.0\stable-diffusion-webui\venv\lib\site-packages\starlette\routing.py", line 276, in handle
    await self.app(scope, receive, send)
  File "I:\Super SD 2.0\stable-diffusion-webui\venv\lib\site-packages\starlette\routing.py", line 66, in app
    response = await func(request)
  File "I:\Super SD 2.0\stable-diffusion-webui\venv\lib\site-packages\fastapi\routing.py", line 237, in app
    raw_response = await run_endpoint_function(
  File "I:\Super SD 2.0\stable-diffusion-webui\venv\lib\site-packages\fastapi\routing.py", line 163, in run_endpoint_function
    return await dependant.call(**values)
  File "I:\Super SD 2.0\stable-diffusion-webui\venv\lib\site-packages\gradio\routes.py", line 402, in predict
    if app.get_blocks().dependencies[fn_index_inferred]["cancels"]:
IndexError: list index out of range

Additional information

This error exists for a quite long time, please fix it.

Woisek avatar Mar 05 '23 09:03 Woisek

  1. possibility add fastapi==0.90.1 to requirements.txt in the webui folder. then double click webui-user.bat

you can remove it after running once, this would install the correct fastapi version.

  1. possibility move all extension folder outside webui. start and confirm that error is gone. move them back slowly and find extension with problem, then mention it in their github

ClashSAN avatar Mar 05 '23 11:03 ClashSAN

@ClashSAN I removed all extension, restarted WebUI, let it load. After that, clicked on "Reload UI" and the same error came up: To create a public link, set share=True in launch(). ERROR: Exception in ASGI application Traceback (most recent call last): File "I:\Super SD 2.0\stable-diffusion-webui\venv\lib\site-packages\anyio\streams\memory.py", line 94, in receive return self.receive_nowait() File "I:\Super SD 2.0\stable-diffusion-webui\venv\lib\site-packages\anyio\streams\memory.py", line 89, in receive_nowait raise WouldBlock anyio.WouldBlock

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "I:\Super SD 2.0\stable-diffusion-webui\venv\lib\site-packages\starlette\middleware\base.py", line 77, in call_next message = await recv_stream.receive() File "I:\Super SD 2.0\stable-diffusion-webui\venv\lib\site-packages\anyio\streams\memory.py", line 114, in receive raise EndOfStream anyio.EndOfStream

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "I:\Super SD 2.0\stable-diffusion-webui\venv\lib\site-packages\uvicorn\protocols\http\h11_impl.py", line 407, in run_asgi result = await app( # type: ignore[func-returns-value] File "I:\Super SD 2.0\stable-diffusion-webui\venv\lib\site-packages\uvicorn\middleware\proxy_headers.py", line 78, in call return await self.app(scope, receive, send) File "I:\Super SD 2.0\stable-diffusion-webui\venv\lib\site-packages\fastapi\applications.py", line 271, in call await super().call(scope, receive, send) File "I:\Super SD 2.0\stable-diffusion-webui\venv\lib\site-packages\starlette\applications.py", line 125, in call await self.middleware_stack(scope, receive, send) File "I:\Super SD 2.0\stable-diffusion-webui\venv\lib\site-packages\starlette\middleware\errors.py", line 184, in call raise exc File "I:\Super SD 2.0\stable-diffusion-webui\venv\lib\site-packages\starlette\middleware\errors.py", line 162, in call await self.app(scope, receive, _send) File "I:\Super SD 2.0\stable-diffusion-webui\venv\lib\site-packages\starlette\middleware\base.py", line 104, in call response = await self.dispatch_func(request, call_next) File "I:\Super SD 2.0\stable-diffusion-webui\modules\api\api.py", line 96, in log_and_time res: Response = await call_next(req) File "I:\Super SD 2.0\stable-diffusion-webui\venv\lib\site-packages\starlette\middleware\base.py", line 80, in call_next raise app_exc File "I:\Super SD 2.0\stable-diffusion-webui\venv\lib\site-packages\starlette\middleware\base.py", line 69, in coro await self.app(scope, receive_or_disconnect, send_no_error) File "I:\Super SD 2.0\stable-diffusion-webui\venv\lib\site-packages\starlette\middleware\gzip.py", line 24, in call await responder(scope, receive, send) File "I:\Super SD 2.0\stable-diffusion-webui\venv\lib\site-packages\starlette\middleware\gzip.py", line 44, in call await self.app(scope, receive, self.send_with_gzip) File "I:\Super SD 2.0\stable-diffusion-webui\venv\lib\site-packages\starlette\middleware\exceptions.py", line 79, in call raise exc File "I:\Super SD 2.0\stable-diffusion-webui\venv\lib\site-packages\starlette\middleware\exceptions.py", line 68, in call await self.app(scope, receive, sender) File "I:\Super SD 2.0\stable-diffusion-webui\venv\lib\site-packages\fastapi\middleware\asyncexitstack.py", line 21, in call raise e File "I:\Super SD 2.0\stable-diffusion-webui\venv\lib\site-packages\fastapi\middleware\asyncexitstack.py", line 18, in call await self.app(scope, receive, send) File "I:\Super SD 2.0\stable-diffusion-webui\venv\lib\site-packages\starlette\routing.py", line 706, in call await route.handle(scope, receive, send) File "I:\Super SD 2.0\stable-diffusion-webui\venv\lib\site-packages\starlette\routing.py", line 276, in handle await self.app(scope, receive, send) File "I:\Super SD 2.0\stable-diffusion-webui\venv\lib\site-packages\starlette\routing.py", line 66, in app response = await func(request) File "I:\Super SD 2.0\stable-diffusion-webui\venv\lib\site-packages\fastapi\routing.py", line 237, in app raw_response = await run_endpoint_function( File "I:\Super SD 2.0\stable-diffusion-webui\venv\lib\site-packages\fastapi\routing.py", line 163, in run_endpoint_function return await dependant.call(**values) File "I:\Super SD 2.0\stable-diffusion-webui\venv\lib\site-packages\gradio\routes.py", line 402, in predict if app.get_blocks().dependencies[fn_index_inferred]["cancels"]: IndexError: list index out of range

Is fastapi==0.90.1 a requirement for the WebUI?

Woisek avatar Mar 05 '23 14:03 Woisek

you might have to rebuild the venv or reinstall i guess. this doesn't show on a fresh install

ClashSAN avatar Mar 05 '23 23:03 ClashSAN

low chance of fixing it, but sometimes trying ctrl + F5 to ignore cache in the browser would help solving list index out of range. i would also suggest remove venv and then rebuild it without any extension in the folder too.

chikiu-san avatar Mar 06 '23 02:03 chikiu-san

OK, any quick instruction on how to safely delete venv and rebuild it without cripple the whole installation, please? :)

Woisek avatar Mar 06 '23 08:03 Woisek

you can remove venv folder and then re-run webui-user.bat again

chikiu-san avatar Mar 07 '23 14:03 chikiu-san

Ouch ... thats ~6.6GB worth of data ... :( And this is all gonna download again ... ? Oh man ...

Woisek avatar Mar 07 '23 18:03 Woisek

OK, let venv rebuild, still errors coming up ...

To create a public link, set share=True in launch(). Traceback (most recent call last): File "I:\Super SD 2.0\stable-diffusion-webui\venv\lib\site-packages\gradio\routes.py", line 337, in run_predict output = await app.get_blocks().process_api( File "I:\Super SD 2.0\stable-diffusion-webui\venv\lib\site-packages\gradio\blocks.py", line 1018, in process_api data = self.postprocess_data(fn_index, result["prediction"], state) File "I:\Super SD 2.0\stable-diffusion-webui\venv\lib\site-packages\gradio\blocks.py", line 956, in postprocess_data prediction_value = block.postprocess(prediction_value) File "I:\Super SD 2.0\stable-diffusion-webui\venv\lib\site-packages\gradio\components.py", line 3742, in postprocess file_path = self.make_temp_copy_if_needed(img) File "I:\Super SD 2.0\stable-diffusion-webui\venv\lib\site-packages\gradio\processing_utils.py", line 376, in make_temp_copy_if_needed f = tempfile.NamedTemporaryFile() File "F:\Programme\Python310\lib\tempfile.py", line 559, in NamedTemporaryFile file = _io.open(dir, mode, buffering=buffering, File "F:\Programme\Python310\lib\tempfile.py", line 556, in opener fd, name = _mkstemp_inner(dir, prefix, suffix, flags, output_type) File "F:\Programme\Python310\lib\tempfile.py", line 256, in _mkstemp_inner fd = _os.open(file, flags, 0o600) FileNotFoundError: [Errno 2] No such file or directory: 'T:\systemp\sd_temp_files\tmpe4svot1d'

Woisek avatar Mar 07 '23 22:03 Woisek

I'm seeing this one as well on latest (as of today) commit. Getting the "IndexError: list index out of range" errors from gradio.

oliverban avatar Mar 21 '23 12:03 oliverban

Just curious if you had resolved your issue? I'm running into the same exact scenario as of 2 days ago. So any help would be appreciated

Grimlock21 avatar Mar 30 '23 01:03 Grimlock21

Solution from https://github.com/AUTOMATIC1111/stable-diffusion-webui/issues/7102 helped. Just reload the page. @Woisek this could be closed probably

bonlime avatar May 06 '23 12:05 bonlime

@bonlime If a reload of the page and/or the WebUI should be a solution ... sorry. A reload/restart of the website/WebUI is always a "solution". But it doesn't solve the cause on why this is happening. As I'm now using vlads repo for some time, I can't say if this still exists, but on vlads version I didn't noticed it conscious. But I will switch for some time and see how it's now going.

Woisek avatar May 06 '23 12:05 Woisek

Occuring in RC 1.5 using Batch IMG2IMG + ControlNet w/ a still image.

A heads up to whoever (Re: Developers):

Suddenly started getting this error after switching to RC 1.5 when trying to use controlnet in IMG2IMG when using batch mode. If I put a still image in one of the control net panels, and a folder for the batch in the IMG2IMG section it'd crash on clicking Generate right away.

I tried the restore in extension to go back, but that didn't resolve it. Multiple restarts/reboots. Finally git checked out back to master branch and no longer get the "List index out of range" error.

Unfortunately since I switched back to 1.4.1 I can't provide more info, nor I have the time at the moment to repull the RC and gather a specific step by step method of reproducing.

That said, I did notice there were some change in that IMG2IMG section like the addition of PNG options. If you are a developer trying to catch/cleanup any issues pre-release, I'd take a look at IMG2IMG batch + Controlnet causing the above listed error.

Otherwise 1.5 was great for me for the past few day. Thx.

CCpt5 avatar Jul 24 '23 05:07 CCpt5

Closing as stale regarding the original issue. What CCpt5 mentions above is related to https://github.com/AUTOMATIC1111/stable-diffusion-webui/issues/12286 and is also fixed on the dev branch.

catboxanon avatar Aug 07 '23 03:08 catboxanon