-
-
Notifications
You must be signed in to change notification settings - Fork 69.3k
[Bug]: Bug]: [Windows] Agent/auth lookup uses wrong state directory path (missing backslash between username and .openclaw) Agent/auth 查找使用错误的状态目录路径(用户名与 .openclaw 之间缺少反斜杠) #40563
Description
Bug type
Behavior bug (incorrect output/state without crash)
Summary
On Windows, the state directory path used for Agent auth lookup is wrongly concatenated as C:\Users<username>.openclaw (missing backslash), while the correct directory created at install is C:\Users<username>.openclaw, causing “No API key found” and breaking auth-dependent features such as local models.
在 Windows 上,Agent 查找 auth 时使用的状态目录路径被错误拼成 C:\Users<用户名>.openclaw(缺少反斜杠),而安装时创建的正确目录是 C:\Users<用户名>.openclaw,导致 “No API key found” 且无法使用本地模型等依赖 auth 的功能。
Steps to reproduce
-
Install OpenClaw on Windows with a short or numeric username; do not set OPENCLAW_STATE_DIR.
-
Configure an auth-dependent setup (e.g. local model custom-127.0.0.1-11434).
-
Start the gateway and chat with the Agent.
-
Check the “Auth store” / “agentDir” path in the error message or
openclaw logs --follow. -
在 Windows 上以纯数字或简短用户名安装 OpenClaw,不设置 OPENCLAW_STATE_DIR。
-
配置依赖 auth 的用法(例如本地模型 custom-127.0.0.1-11434)。
-
启动 gateway 并与 Agent 对话。
-
查看报错或
openclaw logs --follow中的 “Auth store” / “agentDir” 路径。
Expected behavior
Directory creation and auth lookup should use the same state directory: C:\Users\<username>\.openclaw. Auth store path should be C:\Users\<username>\.openclaw\agents\main\agent\auth-profiles.json, and the Agent should read it and complete auth successfully.
创建目录与查找 auth 应使用同一状态目录:C:\Users\<用户名>\.openclaw。Auth store 路径应为 C:\Users\<用户名>\.openclaw\agents\main\agent\auth-profiles.json,Agent 能正确读取该文件并完成认证。
Actual behavior
The path shown in the error is C:\Users\<username>.openclaw\agents\main\agent\auth-profiles.json (username and .openclaw concatenated without a backslash). agentDir is shown as C:\Users\<username>.openclaw\agents\main\agent. The app looks for auth-profiles.json under this wrong path, causing “No API key found for provider …” and the Agent fails before reply. The correct directory C:\Users\<username>\.openclaw\agents\main\agent\ does exist after install.
Logs: openclaw logs --follow
Logs: openclaw logs --follow
错误信息中显示的路径为 C:\Users\<用户名>.openclaw\agents\main\agent\auth-profiles.json(注意用户名与 .openclaw 连在一起,缺少反斜杠)。agentDir 显示为 C:\Users\<用户名>.openclaw\agents\main\agent。程序到错误路径下查找 auth-profiles.json,导致 “No API key found for provider …” 且 Agent 无法在回复前完成认证。而正确的目录 C:\Users\<用户名>\.openclaw\agents\main\agent\ 在安装后已存在。
OpenClaw version
2026.3.7 (42a1394)
Operating system
Windows 11
Install method
npm global
Logs, screenshots, and evidence
**Error message:**
⚠️ Agent failed before reply: No API key found for provider "custom-127-0-0-1-11434". Auth store: C:\Users\<username>.openclaw\agents\main\agent\auth-profiles.json (agentDir: C:\Users\<username>.openclaw\agents\main\agent). Configure auth for this agent (openclaw agents add <id>) or copy auth-profiles.json from the main agentDir.
**Gateway log (diagnostic):**
error diagnostic {"subsystem":"diagnostic"} lane task error: lane=main ... error="Error: No API key found for provider \"custom-127-0-0-1-11434\". Auth store: C:\\Users\\<username>.openclaw\\agents\\main\\agent\\auth-profiles.json (agentDir: ...). ..."
(Use a placeholder for the real Windows username in the path, e.g. C:\Users\XXX.openclaw\... where XXX is the current user, with no backslash before .openclaw.)Impact and severity
- Affected users/systems: Windows users with default state directory and no trailing backslash in homedir (typical), especially when using local models or custom providers that require auth.
- Severity: High — prevents Agent from completing auth before reply; local models / custom providers cannot be used.
- Frequency: 100% reproducible in the above environment when OPENCLAW_STATE_DIR is unset and auth lookup is triggered.
- Consequences: Agent reports “No API key found”, configured models unusable; workaround is setting OPENCLAW_STATE_DIR or waiting for a fix.
Additional information
No response