lllyasviel / stable-diffusion-webui-forge

GNU Affero General Public License v3.0
8.68k stars 863 forks source link

API broken: ERROR: Exception in ASGI application #1098

Open jtang613 opened 3 months ago

jtang613 commented 3 months ago

Running: curl -XGET http://forge:7860/sdapi/v1/sd-models Returns:

ERROR:    Exception in ASGI application
Traceback (most recent call last):
  File "/app/stable-diffusion-webui-forge/venv/lib/python3.10/site-packages/uvicorn/protocols/http/h11_impl.py", line 406, in run_asgi
    result = await app(  # type: ignore[func-returns-value]
  File "/app/stable-diffusion-webui-forge/venv/lib/python3.10/site-packages/uvicorn/middleware/proxy_headers.py", line 70, in __call__
    return await self.app(scope, receive, send)
  File "/app/stable-diffusion-webui-forge/venv/lib/python3.10/site-packages/fastapi/applications.py", line 1106, in __call__
    await super().__call__(scope, receive, send)
  File "/app/stable-diffusion-webui-forge/venv/lib/python3.10/site-packages/starlette/applications.py", line 122, in __call__
    await self.middleware_stack(scope, receive, send)
  File "/app/stable-diffusion-webui-forge/venv/lib/python3.10/site-packages/starlette/middleware/errors.py", line 184, in __call__
    raise exc
  File "/app/stable-diffusion-webui-forge/venv/lib/python3.10/site-packages/starlette/middleware/errors.py", line 162, in __call__
    await self.app(scope, receive, _send)
  File "/app/stable-diffusion-webui-forge/venv/lib/python3.10/site-packages/gradio/route_utils.py", line 724, in __call__
    await self.app(scope, receive, send)
  File "/app/stable-diffusion-webui-forge/venv/lib/python3.10/site-packages/starlette/middleware/exceptions.py", line 79, in __call__
    raise exc
  File "/app/stable-diffusion-webui-forge/venv/lib/python3.10/site-packages/starlette/middleware/exceptions.py", line 68, in __call__
    await self.app(scope, receive, sender)
  File "/app/stable-diffusion-webui-forge/venv/lib/python3.10/site-packages/fastapi/middleware/asyncexitstack.py", line 20, in __call__
    raise e
  File "/app/stable-diffusion-webui-forge/venv/lib/python3.10/site-packages/fastapi/middleware/asyncexitstack.py", line 17, in __call__
    await self.app(scope, receive, send)
  File "/app/stable-diffusion-webui-forge/venv/lib/python3.10/site-packages/starlette/routing.py", line 718, in __call__
    await route.handle(scope, receive, send)
  File "/app/stable-diffusion-webui-forge/venv/lib/python3.10/site-packages/starlette/routing.py", line 276, in handle
    await self.app(scope, receive, send)
  File "/app/stable-diffusion-webui-forge/venv/lib/python3.10/site-packages/starlette/routing.py", line 66, in app
    response = await func(request)
  File "/app/stable-diffusion-webui-forge/venv/lib/python3.10/site-packages/fastapi/routing.py", line 292, in app
    content = await serialize_response(
  File "/app/stable-diffusion-webui-forge/venv/lib/python3.10/site-packages/fastapi/routing.py", line 155, in serialize_response
    raise ResponseValidationError(
fastapi.exceptions.ResponseValidationError: 5 validation errors:
  {'type': 'missing', 'loc': ('response', 0, 'config'), 'msg': 'Field required', 'input': {'title': 'flux1-dev-bnb-nf4.safetensors [c161224931]', 'model_name': 'flux1-dev-bnb-nf4', 'hash': 'c161224931', 'sha256': 'c161224931ab6280cf2ac6cf9060cdbffe78a6ac9b4ff55b89bc23264adc16db', 'filename': '/app/stable-diffusion-webui-forge/models/Stable-diffusion/flux1-dev-bnb-nf4.safetensors'}, 'url': 'https://errors.pydantic.dev/2.8/v/missing'}
  {'type': 'missing', 'loc': ('response', 1, 'config'), 'msg': 'Field required', 'input': {'title': 'flux1-dev.safetensors', 'model_name': 'flux1-dev', 'hash': None, 'sha256': None, 'filename': '/app/stable-diffusion-webui-forge/models/Stable-diffusion/flux1-dev.safetensors'}, 'url': 'https://errors.pydantic.dev/2.8/v/missing'}
  {'type': 'missing', 'loc': ('response', 2, 'config'), 'msg': 'Field required', 'input': {'title': 'flux1-schnell.safetensors', 'model_name': 'flux1-schnell', 'hash': None, 'sha256': None, 'filename': '/app/stable-diffusion-webui-forge/models/Stable-diffusion/flux1-schnell.safetensors'}, 'url': 'https://errors.pydantic.dev/2.8/v/missing'}
  {'type': 'missing', 'loc': ('response', 3, 'config'), 'msg': 'Field required', 'input': {'title': 'sd3_medium_incl_clips_t5xxlfp8.safetensors', 'model_name': 'sd3_medium_incl_clips_t5xxlfp8', 'hash': None, 'sha256': None, 'filename': '/app/stable-diffusion-webui-forge/models/Stable-diffusion/sd3_medium_incl_clips_t5xxlfp8.safetensors'}, 'url': 'https://errors.pydantic.dev/2.8/v/missing'}
  {'type': 'missing', 'loc': ('response', 4, 'config'), 'msg': 'Field required', 'input': {'title': 'v1-5-pruned-emaonly.safetensors', 'model_name': 'v1-5-pruned-emaonly', 'hash': None, 'sha256': None, 'filename': '/app/stable-diffusion-webui-forge/models/Stable-diffusion/v1-5-pruned-emaonly.safetensors'}, 'url': 'https://errors.pydantic.dev/2.8/v/missing'}

Seems like all API endpoints I've tried return similar errors.

davidmartinrius commented 3 months ago

I made a pull request related to this bug: https://github.com/lllyasviel/stable-diffusion-webui-forge/pull/1096

jtang613 commented 3 months ago

Update: That does indeed solve the issue with /sdapi/v1/sd-models but leads to downstream issues later when trying /sdapi/v1/txt2img

davidmartinrius commented 3 months ago

It is a workaround. It will make it work, but lllyasviel needs to decide if it is a good solution or there is a better way. You can work with the change in the PR

davidmartinrius commented 3 months ago

You can close this issue, it has been fixed in main branch

LostRuins commented 2 months ago

Is the fix in the latest release yet? I'm still encountering the error.