Environment
- OpenClaw 3.23 (ccfeecb) and 3.23-1
- macOS 15.7.4 x64
- Plugin:
@tencent-weixin/openclaw-weixin 1.0.2 / 1.0.3
- Plugin install path:
~/.openclaw/extensions/openclaw-weixin/
Steps to Reproduce
- Install OpenClaw 3.23
- Install any user plugin that imports from
openclaw/plugin-sdk (e.g. @tencent-weixin/openclaw-weixin)
- Start or restart the gateway
- Plugin fails to load:
Error: Cannot find module 'openclaw/plugin-sdk'
Bundled plugins (feishu, etc.) work fine — the issue only affects user-installed plugins in ~/.openclaw/extensions/.
Root Cause
In pi-embedded-CwMQzdKD.js, loadOpenClawPlugins() calls buildPluginLoaderAliasMap(modulePath) where modulePath is the plugin file path (e.g. ~/.openclaw/extensions/openclaw-weixin/index.ts). The jiti-based loader uses this to build an alias map for openclaw/plugin-sdk* imports.
The alias map builder has two resolution paths:
1. resolvePluginSdkAliasFile()
Finds root-alias.cjs by walking up to 6 levels from the plugin directory.
For ~/.openclaw/extensions/openclaw-weixin/:
1. ~/.openclaw/extensions/openclaw-weixin/
2. ~/.openclaw/extensions/
3. ~/.openclaw/
4. ~/
5. /Users/
6. /Users/hth/
Never reaches /usr/local/lib/node_modules/openclaw/ → returns null.
2. resolvePluginSdkScopedAliasMap()
Calls resolveLoaderPluginSdkPackageRoot() → resolveOpenClawPackageRootSync() starting from plugin dirname, then findNearestPluginSdkPackageRoot() (max 12 levels). Same problem — cannot reach the OpenClaw package root from ~/.openclaw/extensions/.
Why it worked in 3.13
In 3.13, the alias for openclaw/plugin-sdk (main entry only) used a different resolution strategy that could locate the OpenClaw package. In 3.23, both main entry and subpath resolution fail for user-installed plugins.
Bundled plugins work because they are located at /usr/local/lib/node_modules/openclaw/dist/extensions/ — inside the same package tree.
Suggested Fixes
- Search the OpenClaw executable's location as a candidate root in
resolveLoaderPluginSdkPackageRoot()
- Set
NODE_PATH to include the OpenClaw package parent in the gateway LaunchAgent
- Add a config option like
plugins.sdkPath pointing to the OpenClaw installation directory
- Extend the directory walk limit or use
require.resolve() to find the OpenClaw package from the gateway process itself
cc @X_Corperation (who reported the same issue in the community)
Environment
@tencent-weixin/openclaw-weixin1.0.2 / 1.0.3~/.openclaw/extensions/openclaw-weixin/Steps to Reproduce
openclaw/plugin-sdk(e.g.@tencent-weixin/openclaw-weixin)Error: Cannot find module 'openclaw/plugin-sdk'Bundled plugins (feishu, etc.) work fine — the issue only affects user-installed plugins in
~/.openclaw/extensions/.Root Cause
In
pi-embedded-CwMQzdKD.js,loadOpenClawPlugins()callsbuildPluginLoaderAliasMap(modulePath)wheremodulePathis the plugin file path (e.g.~/.openclaw/extensions/openclaw-weixin/index.ts). The jiti-based loader uses this to build an alias map foropenclaw/plugin-sdk*imports.The alias map builder has two resolution paths:
1.
resolvePluginSdkAliasFile()Finds
root-alias.cjsby walking up to 6 levels from the plugin directory.For
~/.openclaw/extensions/openclaw-weixin/:Never reaches
/usr/local/lib/node_modules/openclaw/→ returnsnull.2.
resolvePluginSdkScopedAliasMap()Calls
resolveLoaderPluginSdkPackageRoot()→resolveOpenClawPackageRootSync()starting from plugin dirname, thenfindNearestPluginSdkPackageRoot()(max 12 levels). Same problem — cannot reach the OpenClaw package root from~/.openclaw/extensions/.Why it worked in 3.13
In 3.13, the alias for
openclaw/plugin-sdk(main entry only) used a different resolution strategy that could locate the OpenClaw package. In 3.23, both main entry and subpath resolution fail for user-installed plugins.Bundled plugins work because they are located at
/usr/local/lib/node_modules/openclaw/dist/extensions/— inside the same package tree.Suggested Fixes
resolveLoaderPluginSdkPackageRoot()NODE_PATHto include the OpenClaw package parent in the gateway LaunchAgentplugins.sdkPathpointing to the OpenClaw installation directoryrequire.resolve()to find the OpenClaw package from the gateway process itselfcc @X_Corperation (who reported the same issue in the community)