From e495c963b5b32bbc090ca26e0b2df918e1e58edb Mon Sep 17 00:00:00 2001 From: Daniel Vickers Date: Sat, 18 Jul 2026 09:24:50 -0500 Subject: [PATCH] Fix ValueError when no knowledge base is attached _build_kb_mcp_server() returns a 3-tuple (server, tool_names, tools_by_name) on its normal path, and all three call sites unpack three values. But the early return for the "no KB attached" case still returned a 2-tuple (None, []), so every message sent without a knowledge base attached raised: ValueError: not enough values to unpack (expected 3, got 2) Return (None, [], {}) instead, and update the docstring to match. Co-Authored-By: Claude Opus 4.8 --- claude_agent_pipe.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/claude_agent_pipe.py b/claude_agent_pipe.py index 8da0ed1..7000f49 100644 --- a/claude_agent_pipe.py +++ b/claude_agent_pipe.py @@ -369,8 +369,8 @@ def _build_kb_mcp_server( user_dict: Optional[Dict[str, Any]] = None, event_emitter: Optional[Callable] = None, ): - """Return (mcp_config, tool_names) for a knowledge-base search tool Claude - can invoke, or (None, []) if no KBs are attached. + """Return (mcp_config, tool_names, tools_by_name) for a knowledge-base + search tool Claude can invoke, or (None, [], {}) if no KBs are attached. Result formatting follows OpenWebUI's native RAG shape ( tags + citation event), so Claude's replies render with inline [N] @@ -379,7 +379,7 @@ def _build_kb_mcp_server( that OpenWebUI's middleware already filtered by the user's grants. """ if not knowledge: - return None, [] + return None, [], {} collection_names = [k["id"] for k in knowledge] display = ", ".join(k["name"] for k in knowledge)