immich-steward icon indicating copy to clipboard operation
immich-steward copied to clipboard

Worker 500 error and queue exception

Open trugty opened this issue 3 days ago • 1 comments

I am getting worker errors on 0.15.2 which seem to prevent further processing. The setup has worked fine previously, I think the issue started on 0.15.0 but not certain. The worker is running on Windows with an nvidia gpu, while steward itself is running on a linux host in docker On the worker I see:

2026-12-02 19:32:04,178 INFO steward_worker.cache: cache: 512 MB in memory, 8192 MB on the disk in C:\Users\user\.cache\steward-worker\cache\v1 (8192 MB asked, 0 MB used)
2026-12-02 19:32:22,185 INFO steward_worker.runner: worker user-pc with modules similar, geoclip, details, objects, orientation
2026-12-02 19:32:22,350 INFO steward_worker.runner: registered with the core as 41fceb41-216e-4a36-bd86-5ecc7d2291b7
2026-12-02 19:32:22,373 WARNING steward_worker.runner: core: POST /lease: HTTP 500 Internal Server Error; retrying in 10 s

On the host I see

core-1  | INFO:     192.168.2.200:57359 - "POST /api/worker/lease HTTP/1.1" 500 Internal Server Error
core-1  | ERROR:    Exception in ASGI application
core-1  | Traceback (most recent call last):
core-1  |   File "/app/venv/lib/python3.12/site-packages/uvicorn/protocols/http/h11_impl.py", line 411, in run_asgi
core-1  |     result = await app(  # type: ignore[func-returns-value]
core-1  |              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
core-1  |   File "/app/venv/lib/python3.12/site-packages/uvicorn/middleware/proxy_headers.py", line 63, in __call__
core-1  |     return await self.app(scope, receive, send)
core-1  |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
core-1  |   File "/app/venv/lib/python3.12/site-packages/fastapi/applications.py", line 1216, in __call__
core-1  |     await super().__call__(scope, receive, send)
core-1  |   File "/app/venv/lib/python3.12/site-packages/starlette/applications.py", line 96, in __call__
core-1  |     await self.middleware_stack(scope, receive, send)
core-1  |   File "/app/venv/lib/python3.12/site-packages/starlette/middleware/errors.py", line 186, in __call__
core-1  |     raise exc
core-1  |   File "/app/venv/lib/python3.12/site-packages/starlette/middleware/errors.py", line 164, in __call__
core-1  |     await self.app(scope, receive, _send)
core-1  |   File "/app/venv/lib/python3.12/site-packages/fastapi/telemetry/_asgi.py", line 151, in __call__
core-1  |     await self.app(scope, receive, send)
core-1  |   File "/app/venv/lib/python3.12/site-packages/starlette/middleware/exceptions.py", line 63, in __call__
core-1  |     await wrap_app_handling_exceptions(self.app, conn)(scope, receive, send)
core-1  |   File "/app/venv/lib/python3.12/site-packages/starlette/_exception_handler.py", line 53, in wrapped_app
core-1  |     raise exc
core-1  |   File "/app/venv/lib/python3.12/site-packages/starlette/_exception_handler.py", line 42, in wrapped_app
core-1  |     await app(scope, receive, sender)
core-1  |   File "/app/venv/lib/python3.12/site-packages/fastapi/middleware/asyncexitstack.py", line 18, in __call__
core-1  |     await self.app(scope, receive, send)
core-1  |   File "/app/venv/lib/python3.12/site-packages/starlette/routing.py", line 676, in __call__
core-1  |     await self.middleware_stack(scope, receive, send)
core-1  |   File "/app/venv/lib/python3.12/site-packages/fastapi/routing.py", line 2809, in app
core-1  |     await route.handle(scope, receive, send)
core-1  |   File "/app/venv/lib/python3.12/site-packages/fastapi/routing.py", line 1837, in handle
core-1  |     await self.original_router.handle(scope, receive, send)
core-1  |   File "/app/venv/lib/python3.12/site-packages/fastapi/routing.py", line 2892, in handle
core-1  |     await included_router._handle_selected(scope, receive, send)
core-1  |   File "/app/venv/lib/python3.12/site-packages/fastapi/routing.py", line 1863, in _handle_selected
core-1  |     await original_route.handle(scope, receive, send)
core-1  |   File "/app/venv/lib/python3.12/site-packages/fastapi/routing.py", line 1326, in handle
core-1  |     await effective_context.app(scope, receive, send)
core-1  |   File "/app/venv/lib/python3.12/site-packages/fastapi/routing.py", line 166, in app
core-1  |     await wrap_app_handling_exceptions(app, request)(scope, receive, send)
core-1  |   File "/app/venv/lib/python3.12/site-packages/starlette/_exception_handler.py", line 53, in wrapped_app
core-1  |     raise exc
core-1  |   File "/app/venv/lib/python3.12/site-packages/starlette/_exception_handler.py", line 42, in wrapped_app
core-1  |     await app(scope, receive, sender)
core-1  |   File "/app/venv/lib/python3.12/site-packages/fastapi/routing.py", line 152, in app
core-1  |     response = await f(request)
core-1  |                ^^^^^^^^^^^^^^^^
core-1  |   File "/app/venv/lib/python3.12/site-packages/fastapi/routing.py", line 745, in app
core-1  |     raw_response = await run_endpoint_function(
core-1  |                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
core-1  |   File "/app/venv/lib/python3.12/site-packages/fastapi/routing.py", line 372, in run_endpoint_function
core-1  |     return await dependant.call(**values)
core-1  |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
core-1  |   File "/app/venv/lib/python3.12/site-packages/steward/api/worker.py", line 264, in lease
core-1  |     leased = await worker_queue.lease(db, worker, modules, settings.worker_lease_seconds)
core-1  |              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
core-1  |   File "/app/venv/lib/python3.12/site-packages/steward/worker_queue.py", line 711, in lease
core-1  |     run = await _run_of(db, job)
core-1  |           ^^^^^^^^^^^^^^^^^^^^^^
core-1  |   File "/app/venv/lib/python3.12/site-packages/steward/worker_queue.py", line 859, in _run_of
core-1  |     assert run is not None, f"module job {job.id} has no run"
core-1  |            ^^^^^^^^^^^^^^^
core-1  | AssertionError: module job 797852b5-258e-42a8-9563-ac076060974f has no run

trugty avatar Dec 02 '26 19:12 trugty

Thanks for the report and the logs. It is fixed in 0.15.3.

The cause was a photo removed from Immich while a job for it was still queued. The job stayed without its photo, and every request from the worker failed on it. 0.15.3 removes such jobs when the update starts, and drops them from then on whenever a photo goes away.

To update, on the Linux host in the folder with compose.yaml:

docker compose pull
docker compose up -d

You don't need to change the worker on Windows: only the app changed. It should start taking jobs again within a few seconds, without a restart. If it doesn't, please reopen this issue with the new logs.

Ivamic avatar Dec 02 '26 23:12 Ivamic