OpenClaw Update Fails with "Cannot find module 'grammy'" — Cause and Fix
Multiple GitHub issues filed in the last 24 hours report the same error: running openclaw update causes openclaw doctor to crash immediately with:
Error: Cannot find module 'grammy'
This is a real regression, now fixed in a merged PR (#69895). Here's what's happening and how to get past it right now.
What's causing it
The root cause is a timing issue introduced by the 4.15 plugin packaging change (PR #67099 — "localize bundled plugin runtime deps to their owning extensions").
When openclaw update runs, it:
- Replaces the package files
- Immediately runs
openclaw doctorto validate the install - Doctor triggers the channel registry → Telegram plugin →
telegram/allowed-updates.ts - That file has a static ESM import of
grammyat the top level - But
grammylives underdist/extensions/telegram/node_modules/— which only gets installed later, during plugin loader initialization (ensureBundledPluginRuntimeDeps)
The static import runs before the installer has placed grammy. Crash.
You can reproduce it manually:
rm -rf dist/extensions/telegram/node_modules
openclaw doctor --non-interactive
# → Error: Cannot find module 'grammy'
The fix (already merged)
PR #69895 replaces the top-level static import with a lazy createRequire() call — grammy is only resolved when resolveTelegramAllowedUpdates() is first called, by which point the installer has already run. Fallback constants handle the case where grammy is genuinely absent.
This fix is merged and will ship in the next stable release after 4.15.
How to fix it now (before the patch releases)
Option 1: Run doctor after the plugin deps install
Skip the update-time doctor check and run it manually after a full restart:
openclaw update --skip-doctor # if this flag exists in your version
openclaw gateway restart
openclaw doctor # run after gateway restart completes
Check your version's openclaw update --help for the exact skip flag name.
Option 2: Manually install grammy before running doctor
cd ~/.npm-global/lib/node_modules/openclaw/dist/extensions/telegram
mkdir -p node_modules
npm install grammy --prefix .
openclaw doctor --non-interactive
This pre-places the dependency so the static import resolves. Adjust the path to match your openclaw install location (which openclaw → follow the symlink).
Option 3: Stay on 4.14 until the patch releases
If you're not urgently needing 4.15 features, roll back:
npm install -g --prefix /your/prefix openclaw@2026.4.14
Is this related to the Active Memory timeout bug?
Different issue, same release. The Active Memory timeout is a qmd runtime spawn regression. The grammy crash is a static import timing issue in the update flow. They don't interact — but together they mean 4.15 has two significant known regressions if you use Telegram and Active Memory.
Who's affected
- Anyone running
openclaw updateon 4.15 with Telegram configured - Fresh installs are not affected — only the update path triggers the timing gap
- If you don't use Telegram as a channel, the grammy import doesn't get pulled in and you won't see this error
Running into upgrade issues? ClawReady handles version management and safe upgrades as part of our managed service tier.