datawhalechina/hello-agents · error · HTTPException
重置失败: {str(e)}
Error message
重置失败: {str(e)} What it means
Catch-all handler for POST /config/reset: any exception raised while clearing sessions, memory, or global config is re-raised as HTTP 500 with '重置失败: <original message>'. The detail string is the only diagnostic surface — the original traceback goes to server logs. Causes range from locked/missing files to LLM failures during re-summarization, so read the embedded message to classify.
Source
Thrown at Co-creation-projects/tino-chen-HelloClaw/src/api/config.py:167
)
# 如果清除了会话,也要清除 Agent 内存中的历史记录
if reset_sessions:
agent = get_agent()
if agent:
agent.clear_all_history()
messages = ["配置文件已重置"]
if reset_sessions:
messages.append("会话已清除")
if reset_memory:
messages.append("每日记忆已清除")
if reset_global_config:
messages.append("全局配置已重置")
return {"status": "success", "message": ",".join(messages)}
except Exception as e:
raise HTTPException(status_code=500, detail=f"重置失败: {str(e)}")
@router.get("/agent/info", response_model=AgentInfo)
async def get_agent_info(ws: WorkspaceManager = Depends(get_workspace)):
"""获取助手信息(包括名字)
每次都重新读取 IDENTITY.md 以获取最新的名字
"""
# 从 IDENTITY.md 读取最新的名字
identity = ws.load_config("IDENTITY")
name = "HelloClaw" # 默认名字
if identity:
import re
# 匹配格式: - **名称:** xxx 或 - **名称:** xxx
match = re.search(r'\*\*名称[::]\*\*\s*(.+?)(?:\n|$)', identity)
if match:
name = match.group(1).strip()View on GitHub (pinned to 606a07d341)
Solutions
- Read the embedded exception text in the 500 detail — it names the real failing operation
- Check server stdout/logs for the full traceback at the moment of the request
- Fix filesystem permissions on the workspace tree (chown -R or chmod) and retry
- Narrow the reset scope (only one flag at a time) to isolate which branch throws
- Restart the server so the global Agent is initialized before resetting sessions
Defensive patterns
Strategy: try-catch
Try / catch
try {
const res = await fetch('/api/config/reset', {method:'POST', body: JSON.stringify(payload)});
if (!res.ok) {
const {detail} = await res.json();
report(detail); // detail embeds the real exception message
}
} catch (e) { /* network-level failure */ } Prevention
- Snapshot the workspace directory before reset so failures are recoverable
- Reset one flag at a time to isolate failing branches
- Watch server logs for the traceback behind the 500
When it happens
Trigger: POST /api/config/reset with reset_sessions=true while history files are missing or unreadable; reset_global_config=true when config.json path is not writable; agent global not initialized when a reset branch calls into agent.clear_all_history(); permission errors when the workspace is owned by another user.
Common situations: Running the server from a different user/container than the one that created ~/.helloclaw; workspace on a read-only mount; concurrent reset during an active chat writing to the same session files; first-boot reset before agent initialization completed.
Related errors
AI-assisted analysis of datawhalechina/hello-agents@606a07d341 (2026-08-14).
Data as JSON: /api/errors/88fbd90bd2377e48.
Report an issue: GitHub.