Bug type
Regression (worked before, now fails)
Summary
好的,我帮你整理了一份详细的 Issue 描述,你可以直接复制到 OpenClaw 的 GitHub Issues 页面。如果有需要补充的地方,可以自行修改。
🐛 Issue: Cannot convert argument to a ByteString when calling model provider (zhipu-0ki/GLM-5)
Environment
- OpenClaw version: 2026.3.12 (6472949)
- Node.js version: 22.22.1
- OS: Windows 11 + WSL2 (Ubuntu 22.04)
- Installation method: npm global install
- Model provider:
zhipu-0ki (0ki.cn), model GLM-5
Description
After successful configuration and API key validation (verified via curl), any attempt to use the model through OpenClaw (CLI or Web UI) fails with the following error:
Cannot convert argument to a ByteString because the character at index 7 has a value of 36755 which is greater than 255.
The error appears both when running openclaw agent --message "Hello" --agent main and when the Web UI attempts to connect via WebSocket. The gateway logs show the error originates from the model call:
warn agent/embedded {"event":"embedded_run_agent_end","error":"Cannot convert argument to a ByteString because the character at index 7 has a value of 36755...","model":"GLM-5","provider":"zhipu-0ki",...}
However, directly querying the API with the same key and model works perfectly:
curl https://api.0ki.cn/api/coding/paas/v4/chat/completions \
-H "Content-Type: application/json" \
-H "Authorization: Bearer <valid-key>" \
-d '{"model":"GLM-5","messages":[{"role":"user","content":"Hello"}],"stream":false}'
→ Returns a valid JSON with Chinese content.
Steps to Reproduce
- Install OpenClaw globally:
npm i -g openclaw
- Run
openclaw onboard and configure zhipu-0ki provider with a valid API key and model GLM-5.
- Start the gateway:
openclaw gateway start
- Send a message via CLI:
openclaw agent --message "Hello" --agent main
- Observe the ByteString error.
Expected Behavior
The model should respond normally, and the CLI should display the assistant's reply.
Actual Behavior
The CLI outputs the ByteString error and exits. Web UI also fails to establish a WebSocket connection (though WebSocket itself works, as confirmed by wscat).
Logs (relevant excerpts)
19:55:18 warn agent/embedded {"subsystem":"agent/embedded"} {"event":"embedded_run_agent_end","tags":["error_handling","lifecycle","agent_end","assistant_error"],"runId":"ec298bda-af38-4fac-a48b-955a20e4eed0","isError":true,"error":"Cannot convert argument to a ByteString because the character at index 7 has a value of 36755 which is greater than 255.","failoverReason":null,"model":"GLM-5","provider":"zhipu-0ki","rawErrorPreview":"Cannot convert argument to a ByteString because the character at index 7 has a value of 36755 which is greater than 255.","rawErrorHash":"sha256:43649301909b"}
19:55:18 info Cannot convert argument to a ByteString because the character at index 7 has a value of 36755 which is greater than 255.
Attempted Solutions
- Restarted gateway and system.
- Changed gateway token and cleared browser storage.
- Configured
networkingMode=mirrored in .wslconfig to fix localhost forwarding.
- Tried accessing via IP
172.25.5.84 and 127.0.0.1 with correct token.
- Used SSH tunnels and
wslview to bypass Windows network.
- Verified API key works via
curl.
- Upgraded Node.js to latest 22.x and reinstalled OpenClaw.
- Disabled firewall temporarily.
- Tried different browsers and incognito mode (unrelated to CLI issue).
Configuration (sanitized)
{
"meta": { ... },
"wizard": { ... },
"models": {
"mode": "merge",
"providers": {
"zhipu-0ki": {
"baseUrl": "https://api.0ki.cn/api/coding/paas/v4",
"apiKey": "oki-xxxxx...",
"auth": "api-key",
"api": "openai-completions",
"authHeader": true,
"models": [
{
"id": "GLM-5",
"name": "GLM-5",
"api": "openai-completions",
"contextWindow": 200000,
"maxTokens": 2000000,
"compat": { "maxTokensField": "max_tokens" }
}
]
}
}
},
"agents": {
"defaults": {
"model": { "primary": "zhipu-0ki/GLM-5" },
"models": { "zhipu-0ki/GLM-5": { "alias": "GLM" } },
"workspace": "/home/huancheng/.openclaw/workspace"
}
},
"gateway": {
"port": 18789,
"mode": "local",
"bind": "lan",
"controlUi": {
"allowedOrigins": [
"http://localhost:18789",
"http://127.0.0.1:18789",
"http://172.25.5.84:18789"
]
},
"auth": { "mode": "token", "token": "1234" }
}
}
Additional Notes
- The error seems to be related to how OpenClaw processes the API response containing Chinese characters. The same response is parsed correctly by
curl and other tools.
- The
tools.profile warning about apply_patch may be unrelated but could indicate some tool interference.
- This issue prevents both CLI and Web UI from functioning, making OpenClaw unusable with this provider.
Suggested Next Steps
- Investigate the
ByteString conversion in the model response handling code.
- Check if the issue is specific to this provider's response format (e.g., non-standard JSON or special characters).
- Consider adding a fallback encoding or more robust JSON parsing.
Thank you for looking into this! Let me know if you need more information or logs.
Steps to reproduce
- Install OpenClaw globally:
npm i -g openclaw
- Run
openclaw onboard and configure zhipu-0ki provider with a valid API key and model GLM-5.
- Start the gateway:
openclaw gateway start
- Send a message via CLI:
openclaw agent --message "Hello" --agent main
- Observe the ByteString error.
Expected behavior
at Summary
Actual behavior
🦞 OpenClaw 2026.3.12 (6472949) — Pairing codes exist because even bots believe in consent—and good security hygiene.
│
◇
Cannot convert argument to a ByteString because the character at index 7 has a value of 36755 which is greater than 255.
OpenClaw version
2026.3.12 (6472949)
Operating system
Windows11
Install method
No response
Model
glm-5
Provider / routing chain
at Summary
Config file / key location
19:58:10 warn tools {"subsystem":"tools"} tools.profile (coding) allowlist contains unknown entries (apply_patch). These entries won't match any tool unless the plugin is enabled. 19:58:10 warn agent/embedded {"subsystem":"agent/embedded"} {"event":"embedded_run_agent_end","tags":["error_handling","lifecycle","agent_end","assistant_error"],"runId":"9a8e0193-34a3-4bad-aa1f-aa3d34cba686","isError":true,"error":"Cannot convert argument to a ByteString because the character at index 7 has a value of 36755 which is greater than 255.","failoverReason":null,"model":"GLM-5","provider":"zhipu-0ki","rawErrorPreview":"Cannot convert argument to a ByteString because the character at index 7 has a value of 36755 which is greater than 255.","rawErrorHash":"sha256:43649301909b"} embedded run agent end 19:58:10 info Cannot convert argument to a ByteString because the character at index 7 has a value of 36755 which is greater than 255. 19:58:10 info Cannot conver
Additional provider/model setup details
No response
Logs, screenshots, and evidence
Impact and severity
No response
Additional information
No response
Bug type
Regression (worked before, now fails)
Summary
好的,我帮你整理了一份详细的 Issue 描述,你可以直接复制到 OpenClaw 的 GitHub Issues 页面。如果有需要补充的地方,可以自行修改。
🐛 Issue:
Cannot convert argument to a ByteStringwhen calling model provider (zhipu-0ki/GLM-5)Environment
zhipu-0ki(0ki.cn), modelGLM-5Description
After successful configuration and API key validation (verified via
curl), any attempt to use the model through OpenClaw (CLI or Web UI) fails with the following error:The error appears both when running
openclaw agent --message "Hello" --agent mainand when the Web UI attempts to connect via WebSocket. The gateway logs show the error originates from the model call:However, directly querying the API with the same key and model works perfectly:
→ Returns a valid JSON with Chinese content.
Steps to Reproduce
npm i -g openclawopenclaw onboardand configurezhipu-0kiprovider with a valid API key and modelGLM-5.openclaw gateway startopenclaw agent --message "Hello" --agent mainExpected Behavior
The model should respond normally, and the CLI should display the assistant's reply.
Actual Behavior
The CLI outputs the ByteString error and exits. Web UI also fails to establish a WebSocket connection (though WebSocket itself works, as confirmed by
wscat).Logs (relevant excerpts)
Attempted Solutions
networkingMode=mirroredin.wslconfigto fix localhost forwarding.172.25.5.84and127.0.0.1with correct token.wslviewto bypass Windows network.curl.Configuration (sanitized)
{ "meta": { ... }, "wizard": { ... }, "models": { "mode": "merge", "providers": { "zhipu-0ki": { "baseUrl": "https://api.0ki.cn/api/coding/paas/v4", "apiKey": "oki-xxxxx...", "auth": "api-key", "api": "openai-completions", "authHeader": true, "models": [ { "id": "GLM-5", "name": "GLM-5", "api": "openai-completions", "contextWindow": 200000, "maxTokens": 2000000, "compat": { "maxTokensField": "max_tokens" } } ] } } }, "agents": { "defaults": { "model": { "primary": "zhipu-0ki/GLM-5" }, "models": { "zhipu-0ki/GLM-5": { "alias": "GLM" } }, "workspace": "/home/huancheng/.openclaw/workspace" } }, "gateway": { "port": 18789, "mode": "local", "bind": "lan", "controlUi": { "allowedOrigins": [ "http://localhost:18789", "http://127.0.0.1:18789", "http://172.25.5.84:18789" ] }, "auth": { "mode": "token", "token": "1234" } } }Additional Notes
curland other tools.tools.profilewarning aboutapply_patchmay be unrelated but could indicate some tool interference.Suggested Next Steps
ByteStringconversion in the model response handling code.Thank you for looking into this! Let me know if you need more information or logs.
Steps to reproduce
npm i -g openclawopenclaw onboardand configurezhipu-0kiprovider with a valid API key and modelGLM-5.openclaw gateway startopenclaw agent --message "Hello" --agent mainExpected behavior
at Summary
Actual behavior
🦞 OpenClaw 2026.3.12 (6472949) — Pairing codes exist because even bots believe in consent—and good security hygiene.
│
◇
Cannot convert argument to a ByteString because the character at index 7 has a value of 36755 which is greater than 255.
OpenClaw version
2026.3.12 (6472949)
Operating system
Windows11
Install method
No response
Model
glm-5
Provider / routing chain
at Summary
Config file / key location
19:58:10 warn tools {"subsystem":"tools"} tools.profile (coding) allowlist contains unknown entries (apply_patch). These entries won't match any tool unless the plugin is enabled. 19:58:10 warn agent/embedded {"subsystem":"agent/embedded"} {"event":"embedded_run_agent_end","tags":["error_handling","lifecycle","agent_end","assistant_error"],"runId":"9a8e0193-34a3-4bad-aa1f-aa3d34cba686","isError":true,"error":"Cannot convert argument to a ByteString because the character at index 7 has a value of 36755 which is greater than 255.","failoverReason":null,"model":"GLM-5","provider":"zhipu-0ki","rawErrorPreview":"Cannot convert argument to a ByteString because the character at index 7 has a value of 36755 which is greater than 255.","rawErrorHash":"sha256:43649301909b"} embedded run agent end 19:58:10 info Cannot convert argument to a ByteString because the character at index 7 has a value of 36755 which is greater than 255. 19:58:10 info Cannot conver
Additional provider/model setup details
No response
Logs, screenshots, and evidence
Impact and severity
No response
Additional information
No response