agentscope-ai / agentscope-ai/AgentTeams
通过curl测试本地模型可以连通,但是在Hclaw内置的matrix element web里的对话框和配置好的本地模型对话会报错:Error: Error occurred during execution of model
- Vorherrschende Sprache
- Go
- Sterne
- 5.6k
- Forks
- 692
- Ø Merge
- 5 T. 4 Std.
- Gemergte PRs (30 T.)
- 23
Beschreibung
### Bug Description
HiClaw 通过 Matrix 聊天发送消息「你好」,模型调用固定报错:
进入Manager容器内查看错误日志的主要原因是:
openai.InternalServerError: Error code: 503
[422] MODEL_EXECUTION_FAILED: Error occurred during execution of model: qwen3:1.7b
### Steps to Reproduce
如图:
分别进行了非流式和流式的curl连通测试,没有问题,就是通过Matrix对话有问题,始终没能解决错误日志里的问题。
### AI Analysis
一、环境信息
后端 LLM:Windows Ollama,模型 qwen3:1.7b,OpenAI 兼容接口地址:http://10.146.74.118:11434
客户端:Docker 部署 hiclaw-manager
验证基准:Ubuntu 宿主机 curl 非流式请求完全正常可返回结果
bash
运行
curl http://10.146.74.118:11434/v1/chat/completions \
-H "Content-Type: application/json" \
-H "Authorization: Bearer local-key" \
-d '{
"model": "qwen3:1.7b",
"messages": [{"role":"user","content":"你好"}],
"max_tokens": 512
}'
# 接口正常返回对话内容,Ollama服务、网络、模型本身无故障
二、故障现象
HiClaw 通过 Matrix 聊天发送消息「你好」,模型调用固定报错:
plaintext
openai.InternalServerError: Error code: 503
[422] MODEL_EXECUTION_FAILED: Error occurred during execution of model: qwen3:1.7b
从运行日志可见:HiClaw 下发请求固定携带参数 stream: true,Ollama+qwen3:1.7b 无法处理流式请求,抛出 422/503 异常。
三、已做排查 & 配置优化操作(全部无效)
精简系统提示词:清空 SOUL.md/AGENTS.md 内置超长 Agent 规则,_sys_prompt仅剩简短提示,排除上下文超长超限;
环境变量关闭能力:在hiclaw-manager.env写入如下配置并重启容器,配置不生效,日志依旧 stream=true
env
HICLAW_MODEL_CONTEXT_WINDOW=2048
HICLAW_MODEL_MAX_TOKENS=512
HICLAW_AGENT_SYSTEM_PROMPT=
HICLAW_ENABLE_TOOLS=false
HICLAW_AGENT_REACT_DISABLE=true
HICLAW_STREAMING_RESPONSE=false
底层源码批量修改:全局批量替换项目源码内stream=True→stream=False、修改_openai_model.py强制固定stream=False,重启后运行日志仍然保留 stream: true,报错不变;
关闭 ReAct 智能体 / 工具调用:关闭 Agent 工具链、ReAct 思考逻辑,tool:null,无函数调用入参干扰,故障依旧。
四、问题结论
HICLAW_STREAMING_RESPONSE=false 环境变量未生效,无配置优先级,无法控制模型请求的 stream 参数;
HiClaw 底层代码存在硬编码逻辑,强制 chat.completions 请求启用 stream=true,无法通过配置开关关闭流式输出;
Ollama+qwen3:1.7b 小模型对流式接口兼容性差,仅支持非流式调用,因此 HiClaw 固定流式请求会触发 Ollama 422 MODEL_EXECUTION_FAILED 异常。
### Relevant Logs
```shell
"trace": "Traceback (most recent call last):\n File \"/opt/copaw-venv/lib/python3.11/site-packages/copaw/app/runner/runner.py\", line 535, in query_handler\n async for msg, last in stream_printing_messages(\n File \"/opt/copaw-venv/lib/python3.11/site-packages/agentscope/pipeline/_functional.py\", line 192, in stream_printing_messages\n raise exception from None\n File \"/opt/copaw-venv/lib/python3.11/site-packages/agentscope/agent/_agent_base.py\", line 455, in __call__\n reply_msg = await self.reply(*args, **kwargs)\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n File \"/opt/copaw-venv/lib/python3.11/site-packages/agentscope/agent/_agent_meta.py\", line 120, in async_wrapper\n current_output = await original_func(\n ^^^^^^^^^^^^^^^^^^^^\n File \"/opt/copaw-venv/lib/python3.11/site-packages/copaw/agents/react_agent.py\", line 1026, in reply\n return await super().reply(\n ^^^^^^^^^^^^^^^^^^^^\n File \"/opt/copaw-venv/lib/python3.11/site-packages/agentscope/agent/_agent_meta.py\", line 120, in async_wrapper\n current_output = await original_func(\n ^^^^^^^^^^^^^^^^^^^^\n File \"/opt/copaw-venv/lib/python3.11/site-packages/agentscope/tracing/_trace.py\", line 390, in wrapper\n return await func(self, *args, **kwargs)\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n File \"/opt/copaw-venv/lib/python3.11/site-packages/agentscope/agent/_react_agent.py\", line 437, in reply\n msg_reasoning = await self._reasoning(tool_choice)\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n File \"/opt/copaw-venv/lib/python3.11/site-packages/agentscope/agent/_agent_meta.py\", line 120, in async_wrapper\n current_output = await original_func(\n ^^^^^^^^^^^^^^^^^^^^\n File \"/opt/copaw-venv/lib/python3.11/site-packages/copaw/agents/react_agent.py\", line 693, in _reasoning\n return await super()._reasoning(tool_choice=tool_choice)\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n File \"/opt/copaw-venv/lib/python3.11/site-packages/copaw/agents/tool_guard_mixin.py\", line 646, in _reasoning\n return await super()._reasoning( # type: ignore[misc]\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n File \"/opt/copaw-venv/lib/python3.11/site-packages/agentscope/agent/_agent_meta.py\", line 120, in async_wrapper\n current_output = await original_func(\n ^^^^^^^^^^^^^^^^^^^^\n File \"/opt/copaw-venv/lib/python3.11/site-packages/agentscope/agent/_react_agent.py\", line 568, in _reasoning\n res = await self.model(\n ^^^^^^^^^^^^^^^^^\n File \"/opt/copaw-venv/lib/python3.11/site-packages/copaw/providers/retry_chat_model.py\", line 312, in __call__\n result = await self._inner(*args, **kwargs)\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n File \"/opt/copaw-venv/lib/python3.11/site-packages/copaw/token_usage/model_wrapper.py\", line 48, in __call__\n result = await self._model(\n ^^^^^^^^^^^^^^^^^^\n File \"/opt/copaw-venv/lib/python3.11/site-packages/agentscope/tracing/_trace.py\", line 602, in async_wrapper\n return await func(self, *args, **kwargs)\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n File \"/opt/copaw-venv/lib/python3.11/site-packages/agentscope/model/_openai_model.py\", line 291, in __call__\n response = await self.client.chat.completions.create(**kwargs)\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n File \"/opt/copaw-venv/lib/python3.11/site-packages/openai/resources/chat/completions/completions.py\", line 2739, in create\n return await self._post(\n ^^^^^^^^^^^^^^^^^\n File \"/opt/copaw-venv/lib/python3.11/site-packages/openai/_base_client.py\", line 1931, in post\n return await self.request(cast_to, opts, stream=stream, stream_cls=stream_cls)\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n File \"/opt/copaw-venv/lib/python3.11/site-packages/openai/_base_client.py\", line 1716, in request\n raise self._make_status_error_from_response(err.response) from None\nopenai.InternalServerError: Error code: 503\n",
"exception_type": "ModelExecutionException",
"exception_message": "[422] MODEL_EXECUTION_FAILED: Error occurred during execution of model: qwen3:1.7b",
"request_info": {
"session_id": "matrix:!OjSRpTRbeq5HeTaaXT:matrix-local.hiclaw.io:18080",
"user_id": "!OjSRpTRbeq5HeTaaXT:matrix-local.hiclaw.io:18080",
"channel": "matrix"
},
"request": {
"input": [
{
"sequence_number": null,
"object": "message",
"status": "created",
"error": null,
"id": "msg_b803b66a-79dc-4927-9821-336c48f0c60a",
"type": "message",
"role": "user",
"content": [
{
"sequence_number": null,
"object": "content",
"status": null,
"error": null,
"type": "text",
"index": null,
"delta": false,
"msg_id": null,
"text": "你好"
}
],
"code": null,
"message": null,
"usage": null,
"metadata": null
}
],
"stream": true,
"id": null,
"model": null,
"top_p": null,
"temperature": null,
"frequency_penalty": null,
"presence_penalty": null,
"max_tokens": null,
"stop": null,
"n": 1,
"seed": null,
"tools": null,
"session_id": "matrix:!OjSRpTRbeq5HeTaaXT:matrix-local.hiclaw.io:18080",
"user_id": "!OjSRpTRbeq5HeTaaXT:matrix-local.hiclaw.io:18080",
"channel": "matrix",
"channel_meta": {
"room_id": "!OjSRpTRbeq5HeTaaXT:matrix-local.hiclaw.io:18080",
"is_dm": true,
"worker_name": "manager",
"event_id": "$gcgFf9Td_cj5y2prVRa9eGrUJPORuSxXGNRfmvpuhAs",
"sender_id": "@admin:matrix-local.hiclaw.io:18080"
}
},
"agent_state": {
"memory": {
"content": [
[
{
"id": "msg_b803b66a-79dc-4927-9821-336c48f0c60a",
"name": "user",
"role": "user",
"content": [
{
"type": "text",
"text": "你好"
}
],
"metadata": {},
"timestamp": "2026-06-03 10:57:33.201"
},
[]
]
],
"_compressed_summary": ""
},
"toolkit": {
"active_groups": []
},
"name": "Friday",
"_sys_prompt": "# Agent Identity\n\nYour agent id is `default`. This is your unique identifier in the multi-agent system.\n\n\nYou are a helpful assistant.\n\n\n====================\n- Session ID: matrix:!OjSRpTRbeq5HeTaaXT:matrix-local.hiclaw.io:18080\n- User ID: !OjSRpTRbeq5HeTaaXT:matrix-local.hiclaw.io:18080\n- Channel: matrix\n- OS: Linux 6.17.0-35-generic (x86_64)\n- Working directory: /root/manager-workspace/.copaw/workspaces/default\n- Current date: 2026-06-03 Etc/UTC (Wednesday)\n- Important:\n 1. Prefer using skills when completing tasks (e.g. use the cron skill for scheduled tasks). Consult the relevant skill documentation if unsure.\n 2. When using write_file, if you want to avoid overwriting existing content, use read_file first to inspect the file, then use edit_file for partial updates or appending.\n 3. Use tool calls to perform actions. A response without a tool call indicates the task is complete. To continue a task, you must generate a tool call or provide useful feedback if you are blocked
```
### Component
Manager Agent
### Version / Commit
_No response_
Beitragsleitfaden
Für dieses Repository ist kein Beitragsleitfaden indexiert
Bewertung
Dieses Issue wurde noch nicht bewertet.