-
-
Notifications
You must be signed in to change notification settings - Fork 52.6k
Closed
Description
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:
isBotMentionedFromTargetsfunction -targets.normalizedMentions.includes()called without null checkstripMessageIdHintsin chat-envelope.js -text.includes()without null check- Various uses of
msg.bodywithout 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.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels