Fix Slack Socket Mode Crash
Known Bug โ Build 2026.2.19-2
This crash is a confirmed bug in the Slack plugin's EventEmitter initialization. The fix is to update to the latest version and regenerate your Slack App Token.
The Slack channel crashes immediately on startup with Cannot read properties of undefined (reading 'listeners'). The gateway enters an exponential backoff retry loop but never recovers without a fix.
Next Step
Fix now, then reduce repeat incidents
If this issue keeps coming back, validate your setup in Doctor first, then harden your config.
Jump to Section
The Error in Gateway Logs
The crash happens during channel initialization before any messages are processed. The Slack socket connection never completes, and exponential backoff retries all fail the same way.
Fix: Update OpenClaw + Regenerate App Token
Step 1: Update to Latest Version
npm install -g openclaw@latest
Step 2: Regenerate the Slack App-Level Token
Regenerate in Slack Developer Portal
- 1. Go to api.slack.com/apps
- 2. Select your OpenClaw app
- 3. Click Basic Information in the left sidebar
- 4. Scroll to App-Level Tokens
- 5. Find your token (or create one) with
connections:writescope - 6. Click Regenerate (or Generate Token and Scopes)
- 7. Copy the new
xapp-...token
Step 3: Update Token in OpenClaw Config
openclaw config set channels.slack.appToken "xapp-YOUR-NEW-TOKEN" openclaw gateway restart
Alternative: Rebuild the Slack App Configuration
If regenerating the token doesn't fix it, try creating a brand new Slack app and configuring it fresh. Some configuration combinations trigger the EventEmitter bug in ways that a token regeneration alone can't fix.
Verify Slack App Setup
Socket Mode is enabled
Slack App โ Settings โ Socket Mode โ Enable Socket Mode
App-Level Token has connections:write
Basic Information โ App-Level Tokens โ Token must include connections:write scope
Bot Token Scopes are correct
OAuth & Permissions โ Bot Token Scopes: chat:write, channels:read, channels:history, app_mentions:read
Event Subscriptions are enabled
Event Subscriptions โ Enable Events โ Subscribe to: message.channels, app_mention
Required Slack Scopes
Bot Token Scopes (xoxb-)
chat:writechannels:readchannels:historyapp_mentions:readim:readim:historyim:writeApp-Level Token Scopes (xapp-)
connections:writeApp-Level Token is required for Socket Mode โ it's different from the Bot Token.
Slack Won't Send Files (files:write Scope)
Even with files:write scope granted, Slack file uploads may fail silently. This is because the legacy files.upload API was deprecated โ OpenClaw needs to use files.uploadV2, which requires the bot to be a member of the target channel.
Diagnosis Steps
- 1Verify
files:writeandfiles:readscopes are granted in OAuth & Permissions - 2In the target channel, type
/invite @YourBotto add the bot - 3Update to the latest OpenClaw which uses
files.uploadV2
npm install -g openclaw@latest openclaw gateway restart
Common Pitfall
Having files:write scope is not enough โ the bot must also be a member of the channel where files are being uploaded. DMs work automatically, but public/private channels require an explicit /invite.
Still Crashing?
Check the exact crash location in logs:
openclaw logs --follow | grep -i slack
Run the Doctor
Checks channel configuration, token validity, and gateway health.
Related Channel Issues
Similar issues on other platforms:
Fix It Faster With Our Tools
Did this guide solve your problem?