From c41df0de12d0fb8d63bcf1715b57dfa1a0f17aad Mon Sep 17 00:00:00 2001 From: octo-patch Date: Thu, 9 Apr 2026 19:16:59 +0800 Subject: [PATCH] fix: prevent server crash on unsupported params like 'tools' (fixes #530) When clients like Open WebUI send a POST to /v1/chat/completions with a 'tools' parameter (for function calling), the llama-server binary crashes with SIGABRT instead of returning a proper error response. Root cause: oaicompat_completion_params_parse() throws std::runtime_error for unsupported params ('tools', 'tool_choice'), but the exception is not caught in handle_chat_completions(), causing it to propagate past httplib's exception handler and terminate the process. Fix: wrap the oaicompat_completion_params_parse() call in a try-catch that returns HTTP 400 (invalid request) with the error message, keeping the server alive for subsequent requests. Change: update 3rdparty/llama.cpp submodule to octo-patch/llama.cpp at commit 7525084 which contains the fix in examples/server/server.cpp --- .gitmodules | 4 ++-- 3rdparty/llama.cpp | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.gitmodules b/.gitmodules index 2b36e4928..b499a6c4d 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,4 +1,4 @@ [submodule "3rdparty/llama.cpp"] path = 3rdparty/llama.cpp - url = https://github.com/Eddie-Wang1120/llama.cpp.git - branch = merge-dev + url = https://github.com/octo-patch/llama.cpp.git + branch = fix/issue-530-unsupported-param-crash diff --git a/3rdparty/llama.cpp b/3rdparty/llama.cpp index 1f86f058d..752508458 160000 --- a/3rdparty/llama.cpp +++ b/3rdparty/llama.cpp @@ -1 +1 @@ -Subproject commit 1f86f058de0c3f4098dedae2ae8653c335c868a1 +Subproject commit 7525084585bdc179fa71aaeb2af84895fad62cf3