mirror of
https://github.com/open-webui/open-webui.git
synced 2026-07-15 21:19:39 -05:00
[GH-ISSUE #14520] issue: 400: Unrecognized request argument supplied: num_keep #17285
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @FrankenLab on GitHub (May 30, 2025).
Original GitHub issue: https://github.com/open-webui/open-webui/issues/14520
Check Existing Issues
Installation Method
Docker
Open WebUI Version
v0.6.13 (latest)
Ollama Version (if applicable)
ollama version is 0.9.0
Operating System
Ubuntu 22.04
Browser (if applicable)
Brave
Confirmation
README.md.Expected Behavior
I submit a question at the prompt and I get an answer.
Actual Behavior
I submit a question and I get the error: 400: Unrecognized request argument supplied: num_keep
Steps to Reproduce
I followed the upgrade instructions here: https://docs.openwebui.com/getting-started/updating/
I started the container with:
podman run -d -p 3000:8080 -v open-webui:/app/backend/data --name open-webui-root ghcr.io/open-webui/open-webui:main
I refreshed my browser
I logged in using my existing admin user (only user).
I tried to resume a chat with OpenAI with chatgpt-4o-latest
When I submitted the question, there was a delay and I got the error 400: Unrecognized request argument supplied: num_keep
I started a new chat and just typed Hello, same LLM, got the same error.
I went into settings for that specific model, found the 'num_keep' parameter (24) and set it to '0'.
I tried a new chat with the same model, same result.
I went back to settings and tried setting the value to '-1', same result
I searched the web, I searched the issue, I searched the discussions, and here I am.
This only seems to be happening with OpenAI API models, not Ollama.
Logs & Screenshots
Traceback (most recent call last):
2025-05-30 05:45:01.175 | INFO | uvicorn.protocols.http.httptools_impl:send:476 - 10.0.10.50:10072 - "GET /api/models HTTP/1.1" 200 - {}
2025-05-30 05:45:01.201 | INFO | open_webui.routers.openai:get_all_models:391 - get_all_models() - {}
2025-05-30 05:45:01.201 | INFO | open_webui.routers.ollama:get_all_models:323 - get_all_models() - {}
2025-05-30 05:45:01.701 | INFO | uvicorn.protocols.http.httptools_impl:send:476 - 10.0.10.50:10071 - "GET /api/models HTTP/1.1" 200 - {}
2025-05-30 05:45:07.723 | INFO | uvicorn.protocols.http.httptools_impl:send:476 - 10.0.10.50:10083 - "POST /api/v1/chats/dee58771-16d9-4ac7-a99d-01c22f90120e HTTP/1.1" 200 - {}
2025-05-30 05:45:07.753 | INFO | uvicorn.protocols.http.httptools_impl:send:476 - 10.0.10.50:10083 - "GET /api/v1/chats/?page=1 HTTP/1.1" 200 - {}
2025-05-30 05:45:07.865 | INFO | open_webui.routers.openai:get_all_models:391 - get_all_models() - {}
2025-05-30 05:45:08.858 | ERROR | open_webui.routers.openai:generate_chat_completion:870 - 400, message='Bad Request', url='https://api.openai.com/v1/chat/completions' - {}
Traceback (most recent call last):
File "", line 198, in _run_module_as_main
File "", line 88, in _run_code
File "/usr/local/lib/python3.11/site-packages/uvicorn/main.py", line 4, in
uvicorn.main()
│ └
└ <module 'uvicorn' from '/usr/local/lib/python3.11/site-packages/uvicorn/init.py'>
File "/usr/local/lib/python3.11/site-packages/click/core.py", line 1442, in call
return self.main(args, **kwargs)
│ │ │ └ {}
│ │ └ ()
│ └ <function Command.main at 0x716febeae7a0>
└
File "/usr/local/lib/python3.11/site-packages/click/core.py", line 1363, in main
rv = self.invoke(ctx)
│ │ └ <click.core.Context object at 0x716fecbe0850>
│ └ <function Command.invoke at 0x716febeae480>
└
File "/usr/local/lib/python3.11/site-packages/click/core.py", line 1226, in invoke
return ctx.invoke(self.callback, **ctx.params)
│ │ │ │ │ └ {'host': '0.0.0.0', 'port': 8080, 'forwarded_allow_ips': '', 'workers': 1, 'app': 'open_webui.main:app', 'uds': None, 'fd': ...
│ │ │ │ └ <click.core.Context object at 0x716fecbe0850>
│ │ │ └ <function main at 0x716febc97a60>
│ │ └
│ └ <function Context.invoke at 0x716febead6c0>
└ <click.core.Context object at 0x716fecbe0850>
File "/usr/local/lib/python3.11/site-packages/click/core.py", line 794, in invoke
return callback(args, **kwargs)
│ │ └ {'host': '0.0.0.0', 'port': 8080, 'forwarded_allow_ips': '', 'workers': 1, 'app': 'open_webui.main:app', 'uds': None, 'fd': ...
│ └ ()
└ <function main at 0x716febc97a60>
File "/usr/local/lib/python3.11/site-packages/uvicorn/main.py", line 412, in main
run(
└ <function run at 0x716febeb39c0>
File "/usr/local/lib/python3.11/site-packages/uvicorn/main.py", line 579, in run
server.run()
│ └ <function Server.run at 0x716febd48e00>
└ <uvicorn.server.Server object at 0x716febee2050>
File "/usr/local/lib/python3.11/site-packages/uvicorn/server.py", line 66, in run
return asyncio.run(self.serve(sockets=sockets))
│ │ │ │ └ None
│ │ │ └ <function Server.serve at 0x716febd48ea0>
│ │ └ <uvicorn.server.Server object at 0x716febee2050>
│ └ <function run at 0x716fec28d260>
└ <module 'asyncio' from '/usr/local/lib/python3.11/asyncio/init.py'>
File "/usr/local/lib/python3.11/asyncio/runners.py", line 190, in run
return runner.run(main)
│ │ └ <coroutine object Server.serve at 0x716febc422f0>
│ └ <function Runner.run at 0x716fec104e00>
└ <asyncio.runners.Runner object at 0x716febca3090>
File "/usr/local/lib/python3.11/asyncio/runners.py", line 118, in run
return self._loop.run_until_complete(task)
│ │ │ └ <Task pending name='Task-1' coro=<Server.serve() running at /usr/local/lib/python3.11/site-packages/uvicorn/server.py:70> wai...
│ │ └ <cyfunction Loop.run_until_complete at 0x716febc83440>
│ └ <uvloop.Loop running=True closed=False debug=False>
└ <asyncio.runners.Runner object at 0x716febca3090>
File "/usr/local/lib/python3.11/site-packages/starlette/middleware/base.py", line 141, in coro
await self.app(scope, receive_or_disconnect, send_no_error)
│ │ │ │ └ <function BaseHTTPMiddleware.call..call_next..send_no_error at 0x716efdefbe20>
│ │ │ └ <function BaseHTTPMiddleware.call..call_next..receive_or_disconnect at 0x716efdefb6a0>
│ │ └ {'type': 'http', 'asgi': {'version': '3.0', 'spec_version': '2.3'}, 'http_version': '1.1', 'server': ('10.88.0.5', 8080), 'cl...
│ └ <starlette_compress.CompressMiddleware object at 0x716feafb2390>
└ <open_webui.main.RedirectMiddleware object at 0x716efee77790>
File "/usr/local/lib/python3.11/site-packages/starlette_compress/init.py", line 96, in call
return await self._gzip(scope, receive, send)
│ │ │ │ └ <function BaseHTTPMiddleware.call..call_next..send_no_error at 0x716efdefbe20>
│ │ │ └ <function BaseHTTPMiddleware.call..call_next..receive_or_disconnect at 0x716efdefb6a0>
│ │ └ {'type': 'http', 'asgi': {'version': '3.0', 'spec_version': '2.3'}, 'http_version': '1.1', 'server': ('10.88.0.5', 8080), 'cl...
│ └ <member '_gzip' of 'CompressMiddleware' objects>
└ <starlette_compress.CompressMiddleware object at 0x716feafb2390>
File "/usr/local/lib/python3.11/site-packages/starlette_compress/_gzip.py", line 110, in call
await self.app(scope, receive, wrapper)
│ │ │ │ └ <function GZipResponder.call..wrapper at 0x716efdef9e40>
│ │ │ └ <function BaseHTTPMiddleware.call..call_next..receive_or_disconnect at 0x716efdefb6a0>
│ │ └ {'type': 'http', 'asgi': {'version': '3.0', 'spec_version': '2.3'}, 'http_version': '1.1', 'server': ('10.88.0.5', 8080), 'cl...
│ └ <member 'app' of 'GZipResponder' objects>
└ <starlette_compress._gzip.GZipResponder object at 0x716efeb0e800>
File "/usr/local/lib/python3.11/site-packages/starlette/middleware/exceptions.py", line 62, in call
await wrap_app_handling_exceptions(self.app, conn)(scope, receive, send)
│ │ │ │ │ │ └ <function GZipResponder.call..wrapper at 0x716efdef9e40>
│ │ │ │ │ └ <function BaseHTTPMiddleware.call..call_next..receive_or_disconnect at 0x716efdefb6a0>
│ │ │ │ └ {'type': 'http', 'asgi': {'version': '3.0', 'spec_version': '2.3'}, 'http_version': '1.1', 'server': ('10.88.0.5', 8080), 'cl...
│ │ │ └ <starlette.requests.Request object at 0x716efdedbdd0>
│ │ └ <fastapi.routing.APIRouter object at 0x716f6f3260d0>
│ └ <starlette.middleware.exceptions.ExceptionMiddleware object at 0x716f74a02810>
└ <function wrap_app_handling_exceptions at 0x716fe8fbde40>
File "/usr/local/lib/python3.11/site-packages/starlette/_exception_handler.py", line 42, in wrapped_app
await app(scope, receive, sender)
│ │ │ └ <function wrap_app_handling_exceptions..wrapped_app..sender at 0x716efdefa340>
│ │ └ <function BaseHTTPMiddleware.call..call_next..receive_or_disconnect at 0x716efdefb6a0>
│ └ {'type': 'http', 'asgi': {'version': '3.0', 'spec_version': '2.3'}, 'http_version': '1.1', 'server': ('10.88.0.5', 8080), 'cl...
└ <fastapi.routing.APIRouter object at 0x716f6f3260d0>
File "/usr/local/lib/python3.11/site-packages/starlette/routing.py", line 715, in call
await self.middleware_stack(scope, receive, send)
│ │ │ │ └ <function wrap_app_handling_exceptions..wrapped_app..sender at 0x716efdefa340>
│ │ │ └ <function BaseHTTPMiddleware.call..call_next..receive_or_disconnect at 0x716efdefb6a0>
│ │ └ {'type': 'http', 'asgi': {'version': '3.0', 'spec_version': '2.3'}, 'http_version': '1.1', 'server': ('10.88.0.5', 8080), 'cl...
│ └ <bound method Router.app of <fastapi.routing.APIRouter object at 0x716f6f3260d0>>
└ <fastapi.routing.APIRouter object at 0x716f6f3260d0>
File "/usr/local/lib/python3.11/site-packages/starlette/routing.py", line 735, in app
await route.handle(scope, receive, send)
│ │ │ │ └ <function wrap_app_handling_exceptions..wrapped_app..sender at 0x716efdefa340>
│ │ │ └ <function BaseHTTPMiddleware.call..call_next..receive_or_disconnect at 0x716efdefb6a0>
│ │ └ {'type': 'http', 'asgi': {'version': '3.0', 'spec_version': '2.3'}, 'http_version': '1.1', 'server': ('10.88.0.5', 8080), 'cl...
│ └ <function Route.handle at 0x716fe8fbf420>
└ APIRoute(path='/api/chat/completions', name='chat_completion', methods=['POST'])
File "/usr/local/lib/python3.11/site-packages/starlette/routing.py", line 288, in handle
await self.app(scope, receive, send)
│ │ │ │ └ <function wrap_app_handling_exceptions..wrapped_app..sender at 0x716efdefa340>
│ │ │ └ <function BaseHTTPMiddleware.call..call_next..receive_or_disconnect at 0x716efdefb6a0>
│ │ └ {'type': 'http', 'asgi': {'version': '3.0', 'spec_version': '2.3'}, 'http_version': '1.1', 'server': ('10.88.0.5', 8080), 'cl...
│ └ <function request_response..app at 0x716efe1dc4a0>
└ APIRoute(path='/api/chat/completions', name='chat_completion', methods=['POST'])
File "/usr/local/lib/python3.11/site-packages/starlette/routing.py", line 76, in app
await wrap_app_handling_exceptions(app, request)(scope, receive, send)
│ │ │ │ │ └ <function wrap_app_handling_exceptions..wrapped_app..sender at 0x716efdefa340>
│ │ │ │ └ <function BaseHTTPMiddleware.call..call_next..receive_or_disconnect at 0x716efdefb6a0>
│ │ │ └ {'type': 'http', 'asgi': {'version': '3.0', 'spec_version': '2.3'}, 'http_version': '1.1', 'server': ('10.88.0.5', 8080), 'cl...
│ │ └ <starlette.requests.Request object at 0x716efdedb710>
│ └ <function request_response..app..app at 0x716efdefa520>
└ <function wrap_app_handling_exceptions at 0x716fe8fbde40>
File "/usr/local/lib/python3.11/site-packages/starlette/exception_handler.py", line 42, in wrapped_app
await app(scope, receive, sender)
│ │ │ └ <function wrap_app_handling_exceptions..wrapped_app..sender at 0x716efdef8e00>
│ │ └ <function BaseHTTPMiddleware.call..call_next..receive_or_disconnect at 0x716efdefb6a0>
│ └ {'type': 'http', 'asgi': {'version': '3.0', 'spec_version': '2.3'}, 'http_version': '1.1', 'server': ('10.88.0.5', 8080), 'cl...
└ <function request_response..app..app at 0x716efdefa520>
File "/usr/local/lib/python3.11/site-packages/starlette/routing.py", line 73, in app
response = await f(request)
│ └ <starlette.requests.Request object at 0x716efdedb710>
└ <function get_request_handler..app at 0x716efeb43ec0>
File "/usr/local/lib/python3.11/site-packages/fastapi/routing.py", line 301, in app
raw_response = await run_endpoint_function(
└ <function run_endpoint_function at 0x716fe8fe5260>
File "/usr/local/lib/python3.11/site-packages/fastapi/routing.py", line 212, in run_endpoint_function
return await dependant.call(**values)
│ │ └ {'user': UserModel(id='2d2fbf17-1078-4152-92b5-4269c0eeffa0', name='admin', email='admin@x.y', role='admin', profile...
│ └ <function chat_completion at 0x716efeb43060>
└ Dependant(path_params=[], query_params=[], header_params=[], cookie_params=[], body_params=[ModelField(field_info=Body(Pydant...
File "/app/backend/open_webui/main.py", line 1285, in chat_completion
response = await chat_completion_handler(request, form_data, user)
│ │ │ └ UserModel(id='2d2fbf17-1078-4152-92b5-4269c0eeffa0', name='admin', email='admin@x.y', role='admin', profile_image_url...
│ │ └ {'stream': True, 'model': 'chatgpt-4o-latest', 'messages': [{'role': 'user', 'content': 'How was this container started? \n$...
│ └ <starlette.requests.Request object at 0x716efdedb710>
└ <function generate_chat_completion at 0x716f74243f60>
File "/app/backend/open_webui/utils/chat.py", line 278, in generate_chat_completion
return await generate_openai_chat_completion(
└ <function generate_chat_completion at 0x716f743d4ea0>
File "/usr/local/lib/python3.11/site-packages/aiohttp/client_reqrep.py", line 1161, in raise_for_status
raise ClientResponseError(
└ <class 'aiohttp.client_exceptions.ClientResponseError'>
aiohttp.client_exceptions.ClientResponseError: 400, message='Bad Request', url='https://api.openai.com/v1/chat/completions'
2025-05-30 05:45:08.860 | INFO | uvicorn.protocols.http.httptools_impl:send:476 - 10.0.10.50:10083 - "POST /api/chat/completions HTTP/1.1" 400 - {}
2025-05-30 05:45:08.881 | INFO | uvicorn.protocols.http.httptools_impl:send:476 - 10.0.10.50:10083 - "GET /api/v1/chats/?page=1 HTTP/1.1" 200 - {}
BROWSER CONSOLE:
Chat.svelte:1831 regenerateResponse
ResponseMessage.svelte:568 <div class="flex justify-start overflow-x-auto buttons text-gray-600 dark:text-gray-500 mt-0.5 svelte-1u5gq5j">…flex
Chat.svelte:1489 modelId o4-mini
+layout.svelte:113 usage {models: Array(1)}
+layout.svelte:113 usage {models: Array(1)}
+layout.svelte:113 usage {models: Array(1)}
+layout.svelte:113 usage {models: Array(1)}
+layout.svelte:113 usage {models: Array(1)}
+layout.svelte:113 usage {models: Array(1)}
+layout.svelte:113 usage {models: Array(1)}
+layout.svelte:113 usage {models: Array(1)}
+layout.svelte:113 usage {models: Array(0)}
MessageInput.svelte:434 destroy
Chat.svelte:429 mounted
RichTextInput.svelte:192 content
RichTextInput.svelte:194 [tiptap warn]: Duplicate extension names found: ['codeBlock']. This can lead to issues.
resolve @ index.js:1183
pn @ index.js:1169
createExtensionManager @ index.js:4580
Wf @ index.js:4412
(anonymous) @ RichTextInput.svelte:194
await in (anonymous)
J @ utils.js:41
(anonymous) @ Component.js:47
_t @ scheduler.js:99
Promise.then
ut @ scheduler.js:20
ht @ Component.js:81
(anonymous) @ Component.js:139
s.$$set @ root.svelte:69
$set @ Component.js:507
Z @ client.js:1576
await in Z
xe @ client.js:398
gn @ client.js:1926
ue @ Sidebar.svelte:492
Chat.svelte:1316 submitPrompt hello
Chat.svelte:195 saveSessionSelectedModels ['chatgpt-4o-latest'] ["chatgpt-4o-latest"]
MessageInput.svelte:434 destroy
ResponseMessage.svelte:568 <div class="flex justify-start overflow-x-auto buttons text-gray-600 dark:text-gray-500 mt-0.5 svelte-1u5gq5j">
RichTextInput.svelte:192 content
RichTextInput.svelte:194 [tiptap warn]: Duplicate extension names found: ['codeBlock']. This can lead to issues.
resolve @ index.js:1183
pn @ index.js:1169
createExtensionManager @ index.js:4580
Wf @ index.js:4412
(anonymous) @ RichTextInput.svelte:194
await in (anonymous)
J @ utils.js:41
(anonymous) @ Component.js:47
_t @ scheduler.js:99
Promise.then
ut @ scheduler.js:20
ht @ Component.js:81
(anonymous) @ Component.js:139
wt @ Chat.svelte:1368
st @ Chat.svelte:2162
await in st
(anonymous) @ lifecycle.js:105
(anonymous) @ lifecycle.js:104
Q @ Placeholder.svelte:218
(anonymous) @ lifecycle.js:105
(anonymous) @ lifecycle.js:104
zo @ MessageInput.svelte:861
(anonymous) @ lifecycle.js:105
(anonymous) @ lifecycle.js:104
keydown @ RichTextInput.svelte:349
(anonymous) @ index.js:3108
someProp @ index.js:5502
Ao @ index.js:3106
Vp.t.dom.addEventListener.t.input.eventHandlers. @ index.js:3075
ResponseMessage.svelte:568 <div class="flex justify-start overflow-x-auto buttons text-gray-600 dark:text-gray-500 mt-0.5 svelte-1u5gq5j">flex
Chat.svelte:1489 modelId chatgpt-4o-latest
Additional Information
I had a working setup with docker(podman) 'official image' before upgrading to the latest official container from v6.126? (can't check container is gone now).
I'm using OpenAI with my API key, however, when I use Ollama with a local model it works as expected.
I tried going to settings and changing the model parameter num_keep to 0 and -1 for GPT4o-Latest and that didn't work.
I tried changing the same settings for the specific chat, same result.
I tried restarting the container, clearing browser cache, and that didn't help.
I have a lot of chats that I don't want to lose.
@mmolinari commented on GitHub (May 30, 2025):
I was getting the same issue with OpenAI models, but in my case the issue was with "num_ctx".
I checked the models, and indeed for some reason some (but not all) OpenAI models has num_ctx set to 128000.
I don't think I ever set them, but I may be wrong.
(edit: I see it was set also in a custom model, which indeed broke it, and I'm quite sure I didn't set it at least there)
Once I reset the parameter to "default" they resumed working: not zero or another value, just click "custom" and it will revert to "default". You may want to try the same.
@FrankenLab commented on GitHub (May 30, 2025):
Wow, WTF. I hadn't changed that value before I upgraded, I only changed it for debugging this problem, but I just tried your suggestion and it worked. Still seems like a bug, but thanks for the heads up!
@rgaricano commented on GitHub (May 30, 2025):
addressed, https://github.com/open-webui/open-webui/discussions/14515#discussioncomment-13314924
@alfloc commented on GitHub (May 30, 2025):
I also get this error with num_keep. All params for the models are set to default. To get rid of it, I have to click on the num_keep setting, set it to custom, then bring it back to Default, and finally run the query again. But initially, it always fails.
@rascazzione commented on GitHub (May 31, 2025):
Same here as other are descriving, in my case all the values are set to default in the model advanced parameters, so I don't know what do I have to do with this... seems like some parameters are inside and when send the request to the api ignore what in the parameters are defined.
@spammenotinoz commented on GitHub (Jun 9, 2025):
Same, running defaults, chat controls are not used, no advanced properties are set.
OpenAIException - Unrecognized request argument supplied: keep_alive"
Somehow the keep_alive parameter was set, changed back to default and the issue fixed.
@rascazzione commented on GitHub (Jun 14, 2025):
Ok, this issue is closed, but I have found where my problem originated. Let me explain:
This was my error:
So, I started looking in Admin Settings -> Settings -> Models -> selected the model -> Advanced Parameters.
There was nothing there.
Next, I visited Chat Controls:
All the parameters were set to "Default".
When I selected and deselected the parameters, the problem was solved, but I wondered why it was happening in the first place.
So, I started looking for any hidden parameter configurations, and "bingo!" I found it in Settings -> Advanced Parameters:
I discovered that I had set parameters here that affected all requests:
I didn’t remember configuring this—maybe I did it in some initial version of OpenWebUI.
After removing all the fields and resetting to default, the service worked again:
Currently, with the Models Advanced configuration available, I’m not sure if this feature (global advanced parameters) should be deprecated and removed. I had forgotten that I configured it, and maybe my models have been running with a bad configuration because of this easily overlooked section.