Skip to content

fix(plugin-sdk): zod bare import fails to resolve in pnpm global installs #78398

@ggzeng

Description

@ggzeng

Bug Report

Summary

After upgrading to OpenClaw 2026.5.x via pnpm install -g openclaw, the bundled plugin-sdk re-export export * from "zod" in dist/plugin-sdk/zod.js fails to resolve at runtime. This causes all channel plugins that depend on plugin-sdk/zod (e.g. feishu, bluebubbles) to silently fail during registration.

Environment

  • OpenClaw: 2026.5.4
  • Install method: pnpm install -g openclaw (pnpm v10.33.0)
  • Node.js: v24.14.0
  • OS: Linux (Docker Ubuntu 24.04)

Reproduction

  1. pnpm install -g openclaw@2026.5.4
  2. openclaw gateway start
  3. Observe gateway logs:
[plugins] feishu failed during register from .../feishu/dist/index.js: Error: Cannot find module 'zod'
Require stack:
- /home/user/.local/share/pnpm/global/5/node_modules/openclaw/dist/plugin-sdk/zod.js
  1. Verify: node -e "require.resolve('zod', {paths:['/path/to/pnpm/global/node_modules/openclaw']})" → MODULE_NOT_FOUND

Root Cause

dist/plugin-sdk/zod.js contains:

import "../zod-D2c0iocA.js";
export * from "zod";

The second line is a runtime bare import of zod. In pnpm's strict dependency isolation mode, zod is NOT hoisted/symlinked into openclaw/node_modules/ during a global install, so Node.js ESM resolution fails.

Verified by removing the manual fix and re-running pnpm install -g — zod is not linked:

$ ls openclaw/node_modules/
# Only .bin/ directory, no zod symlink

Current Workaround

Manually symlink zod into openclaw's node_modules:

OPENCLAW_DIR=$(pnpm root -g)/openclaw
ZOD_STORE=$(find "$(pnpm store path)" -path "*/zod@4.4.3/node_modules/zod" -type d | head -1)
mkdir -p "$OPENCLAW_DIR/node_modules"
ln -s "$ZOD_STORE" "$OPENCLAW_DIR/node_modules/zod"
openclaw gateway restart

Suggested Fix

The build should inline zod into plugin-sdk/zod.js rather than using a bare runtime import. Since this file is a public API re-export for plugins (import { z } from "openclaw/plugin-sdk/zod"), the bundler (esbuild/rollup) should bundle the zod dependency inline rather than marking it external.

Alternatively, add a postinstall or doctor check that ensures zod is resolvable from the openclaw package location.

Related Issues

Metadata

Metadata

Assignees

No one assigned

    Labels

    staleMarked as stale due to inactivity

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions