openclaw - 💡(How to fix) Fix [Bug]: `/new` command causes ERR_MODULE_NOT_FOUND (grammy) during gateway restart [1 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#60481Fetched 2026-04-08 02:50:34
View on GitHub
Comments
0
Participants
1
Timeline
2
Reactions
0
Author
Participants
Timeline (top)
labeled ×2

The /new command triggers a gateway restart that fails to resolve the grammy package in sticker-cache-*.js, causing an ERR_MODULE_NOT_FOUND error. The gateway recovers after page refresh but the webchat session loses its chat history.

Error Message

Error after /new:

Error [ERR_MODULE_NOT_FOUND]: Cannot find package 'grammy' imported from C:\Users\19692\AppData\Roaming\npm\node_modules\openclaw\dist\sticker-cache-Cf0p9p0n.js

Gateway logs (repeated):

[gateway-http] stage "slack" threw — skipping: Error: Cannot find module '@slack/web-api' [ws] webchat disconnected code=1001

Notes: grammy IS installed (v1.41.1 CJS). sticker-cache uses ESM import. Only feishu channel enabled. Reproducible every time.

Root Cause

The /new command triggers a gateway restart that fails to resolve the grammy package in sticker-cache-*.js, causing an ERR_MODULE_NOT_FOUND error. The gateway recovers after page refresh but the webchat session loses its chat history.

Code Example

**Error after `/new`:**

Error [ERR_MODULE_NOT_FOUND]: Cannot find package 'grammy' imported from C:\Users\19692\AppData\Roaming\npm\node_modules\openclaw\dist\sticker-cache-Cf0p9p0n.js


**Gateway logs (repeated):**

[gateway-http] stage "slack" threw — skipping: Error: Cannot find module '@slack/web-api'
[ws] webchat disconnected code=1001


**Notes:** grammy IS installed (v1.41.1 CJS). sticker-cache uses ESM import. Only feishu channel enabled. Reproducible every time.
RAW_BUFFERClick to expand / collapse

Bug type

Behavior bug (incorrect output/state without crash)

Beta release blocker

No

Summary

The /new command triggers a gateway restart that fails to resolve the grammy package in sticker-cache-*.js, causing an ERR_MODULE_NOT_FOUND error. The gateway recovers after page refresh but the webchat session loses its chat history.

Steps to reproduce

  1. Open the OpenClaw webchat UI (openclaw-control-ui).
  2. Type /new to reset the session context.
  3. Observe the error: Error [ERR_MODULE_NOT_FOUND]: Cannot find package 'grammy' imported from ...\dist\sticker-cache-Cf0p9p0n.js
  4. Refresh the page — error disappears but chat history is lost.

Expected behavior

The /new command should cleanly reset the session context without any error. The gateway should not attempt to load Telegram-specific modules (grammy/sticker-cache) during restart when Telegram is not configured as a channel.

Actual behavior

After typing /new, the webchat shows an ERR_MODULE_NOT_FOUND error for grammy imported from sticker-cache-Cf0p9p0n.js. Gateway logs also show Cannot find module '@slack/web-api' with "stage slack threw — skipping". After refreshing, error is gone but chat history is lost.

OpenClaw version

2026.4.2 (d74a122)

Operating system

Windows 11 (10.0.26200, x64)

Install method

npm global install

Model

xiaomi/mimo-v2-pro

Provider / routing chain

xiaomi provider via OpenAI-compatible completions API (webchat -> gateway local)

Additional provider/model setup details

No response

Logs, screenshots, and evidence

**Error after `/new`:**

Error [ERR_MODULE_NOT_FOUND]: Cannot find package 'grammy' imported from C:\Users\19692\AppData\Roaming\npm\node_modules\openclaw\dist\sticker-cache-Cf0p9p0n.js


**Gateway logs (repeated):**

[gateway-http] stage "slack" threw — skipping: Error: Cannot find module '@slack/web-api'
[ws] webchat disconnected code=1001


**Notes:** grammy IS installed (v1.41.1 CJS). sticker-cache uses ESM import. Only feishu channel enabled. Reproducible every time.

Impact and severity

Affected: All users on Windows with npm global install who use /new. Severity: Annoying. Frequency: Always. Consequence: Chat history lost after each /new.

Additional information

The @slack/web-api error is harmless (caught and skipped). Primary issue is grammy import timing during restart. grammy (CJS, v1.41.1) exists in node_modules but ESM import in sticker-cache fails during restart window. After full boot, same import succeeds.

extent analysis

TL;DR

The most likely fix involves ensuring the grammy package is properly resolved during the gateway restart, potentially by adjusting the import method or timing in sticker-cache-*.js.

Guidance

  • Verify that the grammy package version (v1.41.1) is compatible with the current Node.js version and the ESM import used in sticker-cache-*.js.
  • Check if the issue is related to the difference in module systems (CJS vs ESM) and consider using a consistent module system or a compatibility layer.
  • Investigate the possibility of delaying the import of grammy in sticker-cache-*.js until after the gateway has fully restarted, to avoid the ERR_MODULE_NOT_FOUND error.
  • Consider adding error handling or a retry mechanism for importing grammy to mitigate the issue and prevent chat history loss.

Example

No specific code example can be provided without modifying the existing codebase, but adjusting the import statement in sticker-cache-*.js to use a dynamic import or a try-catch block might help resolve the issue.

Notes

The issue seems to be related to the timing of the grammy import during the gateway restart. The fact that the error disappears after a page refresh suggests that the import is successful once the gateway has fully restarted. The difference in module systems (CJS vs ESM) might be contributing to the issue.

Recommendation

Apply a workaround to delay or retry the import of grammy in sticker-cache-*.js to avoid the ERR_MODULE_NOT_FOUND error, as the root cause of the issue is not immediately clear and may require further investigation.

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…

FAQ

Expected behavior

The /new command should cleanly reset the session context without any error. The gateway should not attempt to load Telegram-specific modules (grammy/sticker-cache) during restart when Telegram is not configured as a channel.

Still need to ship something?

×6

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

Back to top recommendations

TRENDING