08:12:09 error diagnostic {"subsystem":"diagnostic"} lane task error: lane=main durationMs=70 error="TypeError: Cannot read properties of undefined (reading 'trim')"
08:12:09 error diagnostic {"subsystem":"diagnostic"} lane task error: lane=session:agent:main:main durationMs=83 error="TypeError: Cannot read properties of undefined (reading 'trim')"
08:12:09 error Embedded agent failed before reply: Cannot read properties of undefined (reading 'trim')
#this question
1 messages · Page 1 of 1 (latest)
That TypeError: Cannot read properties of undefined (reading 'trim') is a gateway-side crash (something is calling .trim() on a value it assumed was a string). The snippet you pasted doesn’t include a stack trace, so we need 1–2 more bits to pin down which codepath it is.
1) First: what version?
Please paste:
openclaw --version
(and OS + how you installed: from source vs npm -g vs npx).
2) Get a stack trace (so we can stop guessing)
Temporarily crank logs to debug and reproduce once:
- If you can run foreground:
OPENCLAW_LOG_LEVEL=debug openclaw --log-level debug gateway run
- Or, if you’re running as a daemon, tail the logs and reproduce the message once:
openclaw logs --follow
Docs for log level overrides: https://docs.openclaw.ai/logging
3) Common workaround if this started “out of nowhere”
This particular class of crash has often been tied to stale/corrupted session state.
Try starting a fresh session in-chat (/new as a standalone message). If the gateway dies before it can even reply, the next step is to move aside the session metadata file (don’t delete it):
Session store location (from the FAQ): ~/.openclaw/agents/<agentId>/sessions/sessions.json
Source: https://docs.openclaw.ai/help/faq#where-does-openclaw-store-its-data
Example (agentId is usually main):
mv ~/.openclaw/agents/main/sessions/sessions.json \
~/.openclaw/agents/main/sessions/sessions.json.bak
Then restart the gateway and try again.
4) If it still happens after that
At that point it’s very likely a real bug triggered by a specific inbound message shape or config edge-case. Paste the debug log excerpt with the stack, and if it’s reproducible we should turn it into a GitHub issue: https://github.com/openclaw/openclaw/issues
@grim robin 16:22:54 [info]: [ '[ws]', 'ws client ready' ]
08:23:17 [diagnostic] lane enqueue: lane=session:agent:main:main queueSize=1
08:23:17 [diagnostic] lane dequeue: lane=session:agent:main:main waitMs=13 queueSize=0
08:23:17 [diagnostic] lane enqueue: lane=main queueSize=1
08:23:17 [diagnostic] lane dequeue: lane=main waitMs=1 queueSize=0
08:23:17 [agent/embedded] embedded run start: runId=f6ff14d0-53d5-418a-959a-c44a5635ab69 sessionId=db264ed9-e707-430f-9875-d92120d33e48 provider=minimax model=MiniMax-M2.1 thinking=off messageChannel=webchat
08:23:17 [gateway] [adp-openclaw] Skipping adp_upload_file for channel: webchat
08:23:17 [diagnostic] lane task error: lane=main durationMs=71 error="TypeError: Cannot read properties of undefined (reading 'trim')"
08:23:17 [diagnostic] lane task error: lane=session:agent:main:main durationMs=77 error="TypeError: Cannot read properties of undefined (reading 'trim')"
16:23:17 Embedded agent failed before reply: Cannot read properties of undefined (reading 'trim')
Good, this extra snippet adds two important clues:
- The run is starting with
messageChannel=webchat(internal dashboard/web UI context), notdiscord. - Right before the crash you get:
[gateway] [adp-openclaw] Skipping adp_upload_file for channel: webchat
That strongly suggests the crash is happening while assembling / filtering tools for the run, and the adp-openclaw plugin is involved (even if it’s “skipping” one tool, it’s still in the tool registry path for that run).
Quick isolation test (high signal)
Please run:
openclaw --version
openclaw plugins list
Then temporarily disable that plugin and restart the gateway:
openclaw plugins disable adp-openclaw
openclaw gateway restart
(If the plugin id in plugins list is slightly different, use that exact id.)
If the crash disappears, we’ve basically confirmed: plugin bug / plugin config edge-case when messageChannel=webchat is present.
Docs for plugin enable/disable: https://docs.openclaw.ai/cli/plugins
If you need ADP, but want the gateway stable
Until the plugin is fixed, the pragmatic options are:
- keep it disabled, or
- only enable it once you’re done testing in the dashboard/webchat UI (close the dashboard tab / disconnect webchat), or
- update the plugin (
openclaw plugins update adp-openclaw) if it’s an npm-installed plugin.