Bug Description
When the Bot is mentioned in Slack, it throws: Cannot read properties of undefined (reading 'includes'). This happens when processing Slack message events with mentions.
Reproduction Steps
- Mention @bot in any Slack channel
- Error appears - Bot responds with the error message instead of processing normally
Environment
- OpenClaw version: 2026.3.1
- Platform: macOS
- Channel: Slack
Root Cause Analysis
After extensive investigation, the bug is in multiple locations in the bundled channel-web.js:
isBotMentionedFromTargets function - targets.normalizedMentions.includes() called without null check
stripMessageIdHints in chat-envelope.js - text.includes() without null check
- Various uses of
msg.body without null checks
The bug is intermittent - shorter messages like "hey" may work while longer ones crash. This suggests timing/async issues in how Slack delivers message payloads.
Patches Applied (but not persisting)
Multiple patches were attempted on dist files but they get overwritten on restart:
- channel-web-*.js:
msg.body ?? ""
- chat-envelope-*.js:
text || text.includes(...)
Recommended Fix
This needs to be fixed in the OpenClaw source code with proper null guards:
- Add optional chaining (
?.) to all .includes() calls
- Add null coalescing (
??) to message body accesses
- The fix should be in the TypeScript source, not the bundled JS
Workaround
None found - bug is in core framework code.
Bug Description
When the Bot is mentioned in Slack, it throws:
Cannot read properties of undefined (reading 'includes'). This happens when processing Slack message events with mentions.Reproduction Steps
Environment
Root Cause Analysis
After extensive investigation, the bug is in multiple locations in the bundled channel-web.js:
isBotMentionedFromTargetsfunction -targets.normalizedMentions.includes()called without null checkstripMessageIdHintsin chat-envelope.js -text.includes()without null checkmsg.bodywithout null checksThe bug is intermittent - shorter messages like "hey" may work while longer ones crash. This suggests timing/async issues in how Slack delivers message payloads.
Patches Applied (but not persisting)
Multiple patches were attempted on dist files but they get overwritten on restart:
msg.body ?? ""text || text.includes(...)Recommended Fix
This needs to be fixed in the OpenClaw source code with proper null guards:
?.) to all.includes()calls??) to message body accessesWorkaround
None found - bug is in core framework code.