I have searched the existing issues and discussions.
Problem Description
Calling the POST /api/tasks/stop/{task_id} is returning the following (at least locally when there's no redis)
return {"status": False, "message": f"Failed to stop task {task_id}."}
Desired Solution you'd like
I suppose status is always true, and the difference is the message
Alternatives Considered
try:awaitasyncio.wait_for(task,timeout=0.1)except(asyncio.CancelledError,asyncio.TimeoutError):pass# Expected - cancel or enforced timeout was hitexceptExceptionase:print(f"Task {task_id} raised exception during cancellation: {e}")finally:tasks.pop(task_id,None)iftask.cancelled()ortask.done():# For some reason cancelled is False but done is Truereturn{"status":True,"message":f"Task {task_id} successfully cancelled."}else:return{"status":True,"message":f"Cancellation requested for {task_id}."}
Additional Context
From the chat UI upon sending a prompt and after starting to get tokens in the assistant message, when clicking Stop button calls this API and noticed Failed to stop task message with status false.
Originally created by @hassan-ajek on GitHub (Sep 30, 2025).
Original GitHub issue: https://github.com/open-webui/open-webui/issues/17920
### Check Existing Issues
- [x] I have searched the existing issues and discussions.
### Problem Description
Calling the `POST /api/tasks/stop/{task_id}` is returning the following (at least locally when there's no redis)
`return {"status": False, "message": f"Failed to stop task {task_id}."}`
### Desired Solution you'd like
I suppose status is always true, and the difference is the message
### Alternatives Considered
```py
try:
await asyncio.wait_for(task, timeout=0.1)
except (asyncio.CancelledError, asyncio.TimeoutError):
pass # Expected - cancel or enforced timeout was hit
except Exception as e:
print(f"Task {task_id} raised exception during cancellation: {e}")
finally:
tasks.pop(task_id, None)
if task.cancelled() or task.done(): # For some reason cancelled is False but done is True
return {"status": True, "message": f"Task {task_id} successfully cancelled."}
else:
return {"status": True, "message": f"Cancellation requested for {task_id}."}
```
### Additional Context
From the chat UI upon sending a prompt and after starting to get tokens in the assistant message, when clicking `Stop` button calls this API and noticed Failed to stop task message with status false.
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Originally created by @hassan-ajek on GitHub (Sep 30, 2025).
Original GitHub issue: https://github.com/open-webui/open-webui/issues/17920
Check Existing Issues
Problem Description
Calling the
POST /api/tasks/stop/{task_id}is returning the following (at least locally when there's no redis)return {"status": False, "message": f"Failed to stop task {task_id}."}Desired Solution you'd like
I suppose status is always true, and the difference is the message
Alternatives Considered
Additional Context
From the chat UI upon sending a prompt and after starting to get tokens in the assistant message, when clicking
Stopbutton calls this API and noticed Failed to stop task message with status false.@tjbck commented on GitHub (Oct 2, 2025):
Addressed in dev!