openclaw - ✅(Solved) Fix [Bug] v2026.4.2: Slack plugin fails to load - @slack/web-api not found [1 pull requests, 3 comments, 3 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
openclaw/openclaw#60004Fetched 2026-04-08 02:37:35
View on GitHub
Comments
3
Participants
3
Timeline
5
Reactions
2
Author
Timeline (top)
commented ×3cross-referenced ×1subscribed ×1

After upgrading OpenClaw from v2026.4.1 to v2026.4.2, the Slack plugin fails to load with the following error:

[plugins] slack failed to load from .../openclaw/dist/extensions/slack/index.js: 
Error: Cannot find module '@slack/web-api'
Require stack:
- .../openclaw/dist/client-Cm0jR4_W.js

This causes all Slack bot connections to fail, making all Slack-bound agents completely unresponsive.

Error Message

[plugins] slack failed to load from .../openclaw/dist/extensions/slack/index.js: Error: Cannot find module '@slack/web-api' Require stack:

  • .../openclaw/dist/client-Cm0jR4_W.js

Root Cause

In v2026.4.1, @slack/web-api and other @slack/* packages were installed at:

openclaw/node_modules/@slack/web-api/

In v2026.4.2, these packages only exist under:

openclaw/dist/extensions/slack/node_modules/@slack/web-api/

The Slack plugin entry point (client-Cm0jR4_W.js) lives in dist/ and requires @slack/web-api, but Node's module resolution cannot find it because the package is nested inside dist/extensions/slack/node_modules/ instead of being at the top-level node_modules/.

Fix Action

Workaround

Create symlinks from the top-level node_modules/@slack/ to the nested copies:

PKG_DIR="$(dirname $(realpath $(which openclaw)))/../lib/node_modules/openclaw"
# Or find your pnpm global store path
SRC="$PKG_DIR/dist/extensions/slack/node_modules/@slack"
DST="$PKG_DIR/node_modules/@slack"
mkdir -p "$DST"
for pkg in bolt logger oauth socket-mode types web-api; do
  ln -sf "$SRC/$pkg" "$DST/$pkg"
done

Then restart the gateway.

PR fix notes

PR #60112: build: fix plugin shared chunk routing to preserve node_modules resolution

Description (problem / solution / changelog)

Summary

  • Problem: tsdown code-splitting hoists shared chunks to the root dist/ directory, breaking Node.js module resolution for bundled plugins (like Slack) that rely on their own isolated node_modules.
  • Why it matters: This causes a fatal MODULE_NOT_FOUND error at runtime for any plugin that uses shared internal code and external dependencies, completely breaking the Slack integration in v2026.4.2.
  • What changed: Injected a custom chunkFileNames output option in tsdown.config.ts. It analyzes the source files of each chunk; if a chunk exclusively belongs to a single plugin, it routes the output back to that plugin's dist/extensions/<id>/ directory.
  • What did NOT change (scope boundary): Core chunk routing and cross-plugin violation chunks still fallback to the root dist/ directory.

Change Type (select all)

  • Bug fix
  • Feature
  • Refactor required for the fix
  • Docs
  • Security hardening
  • Chore/infra

Scope (select all touched areas)

  • Gateway / orchestration
  • Skills / tool execution
  • Auth / tokens
  • Memory / storage
  • Integrations
  • API / contracts
  • UI / DX
  • CI/CD / infra

Linked Issue/PR

  • Closes #60004
  • Related #
  • This PR fixes a bug or regression

Root Cause / Regression History (if applicable)

  • Root cause: The bundler (tsdown/rolldown) extracts shared code within a plugin into a common chunk and outputs it to the root dist/ folder by default. This strips the plugin's physical directory context, preventing Node from finding the plugin's private node_modules.
  • Missing detection / guardrail: The build process did not verify if the generated chunks maintained their expected directory structure for module resolution.
  • Prior context (git blame, prior PR, issue, or refactor if known): N/A
  • Why this regressed now: Likely due to a recent update in how plugins are bundled or a migration to tsdown.
  • If unknown, what was ruled out: N/A

Regression Test Plan (if applicable)

  • Coverage level that should have caught this:
    • Unit test
    • Seam / integration test
    • End-to-end test
    • Existing coverage already sufficient
  • Target test or file: src/infra/tsdown-config.test.ts
  • Scenario the test should lock in: Verify that chunkFileNames correctly routes pure plugin chunks to their respective extensions/<id>/ directories, while keeping mixed/core chunks in the root.
  • Why this is the smallest reliable guardrail: It directly asserts the bundler's output path logic without needing a full e2e build.
  • Existing test that already covers this (if any): None
  • If no new test is added, why not: N/A

User-visible / Behavior Changes

None. Plugins will now load successfully without requiring manual symlink workarounds.

Diagram (if applicable)

Before:
[extensions/slack/src/api.ts] + [extensions/slack/src/token.ts] -> dist/runtime-api-HASH.js (Fails to find node_modules)

After:
[extensions/slack/src/api.ts] + [extensions/slack/src/token.ts] -> dist/extensions/slack/shared-api-HASH.js (Successfully finds node_modules)

Security Impact (required)

  • New permissions/capabilities? No
  • Secrets/tokens handling changed? No
  • New/changed network calls? No
  • Command/tool execution surface changed? No
  • Data access scope changed? No
  • If any Yes, explain risk + mitigation: N/A

Repro + Verification

Environment

  • OS: All
  • Runtime/container: Node.js 22+
  • Model/provider: N/A
  • Integration/channel (if any): Slack (and any other bundled plugin with dependencies)
  • Relevant config (redacted): N/A

Steps

  1. Build the project using pnpm build
  2. Inspect the dist/ directory and observe that Slack's shared chunks are hoisted to the root.
  3. Attempt to run the gateway with the Slack plugin enabled.

Expected

The gateway starts successfully and the Slack plugin loads its dependencies from dist/extensions/slack/node_modules/.

Actual

The gateway crashes with Error: Cannot find module '@slack/web-api'.

Evidence

  • Failing test/log before + passing after
  • Trace/log snippets
  • Screenshot/recording
  • Perf numbers (if relevant)

Human Verification (required)

  • Verified scenarios: Ran the build script and verified the output paths of the generated chunks. Added unit tests to tsdown-config.test.ts to lock in the behavior.
  • Edge cases checked: Verified that core chunks and simulated cross-plugin violation chunks still fallback to the root directory.
  • What you did not verify: Full E2E runtime with a live Slack workspace.

Review Conversations

  • I replied to or resolved every bot review conversation I addressed in this PR.
  • I left unresolved only the conversations that still need reviewer or maintainer judgment.

Compatibility / Migration

  • Backward compatible? Yes
  • Config/env changes? No
  • Migration needed? No
  • If yes, exact upgrade steps: N/A

Risks and Mitigations

  • Risk: The path calculation logic might fail on certain edge-case file paths or operating systems.
    • Mitigation: Used Node's native path.resolve, path.relative, and path.sep to ensure cross-platform compatibility and immunity to parent directory naming conflicts.

Changed files

  • src/infra/tsdown-config.test.ts (modified, +116/-0)
  • tsdown.config.ts (modified, +38/-0)

Code Example

[plugins] slack failed to load from .../openclaw/dist/extensions/slack/index.js: 
Error: Cannot find module '@slack/web-api'
Require stack:
- .../openclaw/dist/client-Cm0jR4_W.js

---

openclaw/node_modules/@slack/web-api/

---

openclaw/dist/extensions/slack/node_modules/@slack/web-api/

---

PKG_DIR="$(dirname $(realpath $(which openclaw)))/../lib/node_modules/openclaw"
# Or find your pnpm global store path
SRC="$PKG_DIR/dist/extensions/slack/node_modules/@slack"
DST="$PKG_DIR/node_modules/@slack"
mkdir -p "$DST"
for pkg in bolt logger oauth socket-mode types web-api; do
  ln -sf "$SRC/$pkg" "$DST/$pkg"
done
RAW_BUFFERClick to expand / collapse

Description

After upgrading OpenClaw from v2026.4.1 to v2026.4.2, the Slack plugin fails to load with the following error:

[plugins] slack failed to load from .../openclaw/dist/extensions/slack/index.js: 
Error: Cannot find module '@slack/web-api'
Require stack:
- .../openclaw/dist/client-Cm0jR4_W.js

This causes all Slack bot connections to fail, making all Slack-bound agents completely unresponsive.

Root Cause

In v2026.4.1, @slack/web-api and other @slack/* packages were installed at:

openclaw/node_modules/@slack/web-api/

In v2026.4.2, these packages only exist under:

openclaw/dist/extensions/slack/node_modules/@slack/web-api/

The Slack plugin entry point (client-Cm0jR4_W.js) lives in dist/ and requires @slack/web-api, but Node's module resolution cannot find it because the package is nested inside dist/extensions/slack/node_modules/ instead of being at the top-level node_modules/.

Affected Packages

All @slack/* packages are affected:

  • @slack/web-api
  • @slack/bolt
  • @slack/socket-mode
  • @slack/logger
  • @slack/oauth
  • @slack/types

Workaround

Create symlinks from the top-level node_modules/@slack/ to the nested copies:

PKG_DIR="$(dirname $(realpath $(which openclaw)))/../lib/node_modules/openclaw"
# Or find your pnpm global store path
SRC="$PKG_DIR/dist/extensions/slack/node_modules/@slack"
DST="$PKG_DIR/node_modules/@slack"
mkdir -p "$DST"
for pkg in bolt logger oauth socket-mode types web-api; do
  ln -sf "$SRC/$pkg" "$DST/$pkg"
done

Then restart the gateway.

Environment

  • OpenClaw version: 2026.4.2 (d74a122)
  • Previous working version: 2026.4.1
  • Node.js: v24.14.0
  • OS: Linux 6.1.0-33-amd64 (x64)
  • Package manager: pnpm v10.30.3
  • Slack mode: socket (multi-account, 18 bot accounts)

Steps to Reproduce

  1. Upgrade OpenClaw to v2026.4.2 via pnpm add -g [email protected]
  2. Have Slack plugin enabled in config with socket mode
  3. Start gateway or run openclaw status
  4. Observe: PluginLoadFailureError: plugin load failed: slack: Error: Cannot find module '@slack/web-api'

Expected Behavior

Slack plugin loads successfully and all bot socket connections are established, as in v2026.4.1.

Additional Context

openclaw doctor reports "Plugins: Loaded 39, Errors: 0" after applying the symlink workaround, confirming the fix works.

extent analysis

TL;DR

Create symlinks from the nested @slack packages to the top-level node_modules directory to resolve the module resolution issue.

Guidance

  • Verify that the @slack packages are indeed nested inside dist/extensions/slack/node_modules/ instead of being at the top-level node_modules/.
  • Run the provided bash script to create symlinks from the top-level node_modules/@slack/ to the nested copies.
  • Restart the gateway after creating the symlinks to ensure the changes take effect.
  • Confirm the fix by running openclaw doctor and checking that the Slack plugin loads successfully.

Example

The provided bash script can be used to create the necessary symlinks:

PKG_DIR="$(dirname $(realpath $(which openclaw)))/../lib/node_modules/openclaw"
SRC="$PKG_DIR/dist/extensions/slack/node_modules/@slack"
DST="$PKG_DIR/node_modules/@slack"
mkdir -p "$DST"
for pkg in bolt logger oauth socket-mode types web-api; do
  ln -sf "$SRC/$pkg" "$DST/$pkg"
done

Notes

This workaround assumes that the issue is solely due to the changed location of the @slack packages in the node_modules directory. If other issues arise, further investigation may be necessary.

Recommendation

Apply the workaround by creating symlinks, as it has been confirmed to work by the openclaw doctor report.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING