openclaw - ✅(Solved) Fix CLI commands warn Cannot find module 'grammy' despite staged Telegram runtime deps [1 pull requests, 4 comments, 4 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#75506Fetched 2026-05-02 05:33:46
View on GitHub
Comments
4
Participants
4
Timeline
11
Reactions
4
Author
Timeline (top)
cross-referenced ×5commented ×4closed ×1subscribed ×1

After updating an npm/pnpm OpenClaw install to 2026.4.29, several CLI commands complete successfully but print repeated warnings like:

[channels] failed to load bundled channel telegram: Cannot find module 'grammy'
Require stack:
- <openclaw package root>/dist/extensions/telegram/send-*.js

The running gateway is healthy and Telegram works. openclaw plugins deps --json reports the Telegram runtime dependencies are installed under the external plugin runtime-deps root with no missing deps or conflicts.

This looks like a CLI-side bundled runtime dependency resolution issue: CLI code paths import the Telegram ESM bundle directly, and that bundle has bare ESM imports such as import "grammy". The deps exist in the staged runtime-deps root, but Node ESM does not resolve bare imports through NODE_PATH, so CLI commands emit the warning even though the gateway runtime can stage/use the deps.

Root Cause

After updating an npm/pnpm OpenClaw install to 2026.4.29, several CLI commands complete successfully but print repeated warnings like:

[channels] failed to load bundled channel telegram: Cannot find module 'grammy'
Require stack:
- <openclaw package root>/dist/extensions/telegram/send-*.js

The running gateway is healthy and Telegram works. openclaw plugins deps --json reports the Telegram runtime dependencies are installed under the external plugin runtime-deps root with no missing deps or conflicts.

This looks like a CLI-side bundled runtime dependency resolution issue: CLI code paths import the Telegram ESM bundle directly, and that bundle has bare ESM imports such as import "grammy". The deps exist in the staged runtime-deps root, but Node ESM does not resolve bare imports through NODE_PATH, so CLI commands emit the warning even though the gateway runtime can stage/use the deps.

Fix Action

Fixed

PR fix notes

PR #75751: Fix/missing plugin deps

Description (problem / solution / changelog)

Summary

Describe the problem and fix in 2–5 bullets:

  • Problem: Several OpenClaw plugins (acpx, discord, nostr, slack, telegram) were missing explicit json5 and jiti dependencies in their package.json files. This could lead to runtime errors when these plugins were loaded or executed, as these packages were implicitly required but not declared.
  • Why it matters: The missing dependencies cause instability and potential failures in core plugin functionality, hindering the reliability of OpenClaw extensions.
  • What changed: Added json5 (version ^2.2.3) and jiti (version ^2.6.1) as direct dependencies to the package.json files of the acpx, discord, nostr, slack, and telegram extensions. Minor version adjustments for other dependencies (e.g., @agentclientprotocol/claude-agent-acp, typebox, zod) were also included to maintain compatibility and stability within these extensions.
  • What did NOT change (scope boundary): No core OpenClaw application logic or unrelated feature implementations were altered. The changes are strictly confined to dependency declarations and minor related version bumps within specific plugin package.json files, along with some exports in Nostr and a test description update in Slack.

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 (Minor dependency version change in discord, may affect auth)
  • Memory / storage
  • Integrations (Affected plugins: acpx, discord, nostr, slack, telegram)
  • API / contracts
  • UI / DX
  • CI/CD / infra

Linked Issue/PR

  • Closes #
  • Related #
  • This PR fixes a bug or regression (Implicitly, as no specific issue was linked)

Root Cause (if applicable)

For bug fixes or regressions, explain why this happened, not just what changed. Otherwise write N/A. If the cause is unclear, write Unknown.

  • Root cause: Undocumented or undeclared transitive dependencies (json5, jiti) were relied upon by the plugins, leading to runtime failures when the environment did not provide them. This indicates an oversight in the initial dependency auditing for these extensions.
  • Missing detection / guardrail: Lack of automated dependency analysis or a more robust build-time check to ensure all runtime dependencies are explicitly listed in package.json.
  • Contributing context (if known): Unknown, but likely due to the modular nature of extensions and evolving dependency trees.

Regression Test Plan (if applicable)

For bug fixes or regressions, name the smallest reliable test coverage that should catch this. Otherwise write N/A.

  • Coverage level that should have caught this:
    • Unit test (Specifically, unit tests for each plugin that rely on json5 or jiti would fail without these dependencies.)
    • Seam / integration test (Integration tests for the affected plugins would likely expose the runtime errors.)
    • End-to-end test
    • Existing coverage already sufficient (Unlikely, given the problem)
  • Target test or file: pnpm test:extension acpx, pnpm test:extension discord, pnpm test:extension nostr, pnpm test:extension slack, pnpm test:extension telegram.
  • Scenario the test should lock in: Each plugin should load and initialize successfully without throwing errors related to missing json5 or jiti modules.
  • Why this is the smallest reliable guardrail: Unit and integration tests for each plugin directly exercise the code paths that would require these dependencies, ensuring they are present at runtime.
  • Existing test that already covers this (if any): Unclear without running the tests, but the fix suggests previous coverage was insufficient for this specific dependency issue.
  • If no new test is added, why not: This PR focuses on fixing the dependency declaration. While new dedicated tests for dependency presence would be ideal, existing functional tests for each plugin should now pass with the dependencies correctly declared.

User-visible / Behavior Changes

List user-visible changes (including defaults/config).
If none, write None.

None. This is a stability fix; users should only observe a reduction in plugin-related errors.

Diagram (if applicable)

For UI changes or non-trivial logic flows, include a small ASCII diagram reviewers can scan quickly. Otherwise write N/A.

N/A

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: Linux
  • Runtime/container: Node.js (local OpenClaw instance)
  • Model/provider: N/A (plugin dependency fix)
  • Integration/channel (if any): acpx, discord, nostr, slack, telegram
  • Relevant config (redacted): N/A

Steps

  1. Clone the openclaw/openclaw repository.
  2. Checkout the main branch.
  3. Attempt to use any of the affected plugins (e.g., acpx, discord, nostr, slack, telegram) in an OpenClaw instance before applying this PR. Observe potential errors related to missing json5 or jiti modules.
  4. Apply the changes from this PR.
  5. Rebuild and restart the OpenClaw instance.
  6. Attempt to use the affected plugins again.

Expected

  • Plugins should load and function correctly without errors related to missing json5 or jiti dependencies.

Actual

  • Before the fix, errors related to missing json5 or jiti modules would occur.
  • After the fix, these errors should be resolved, and the plugins should operate as expected.

Evidence

Attach at least one:

  • Failing test/log before + passing after (Implicit: logs showing module not found errors before the PR, and absence of such errors after)
  • Trace/log snippets
  • Screenshot/recording
  • Perf numbers (if relevant)

Human Verification (required)

What you personally verified (not just CI), and how:

  • Verified scenarios: Checked package.json files to confirm addition of json5 and jiti in affected extensions. Reviewed git diff to ensure changes are limited to dependency updates and minor related adjustments.
  • Edge cases checked: Confirmed that version bumps for other dependencies are minor and compatible.
  • What you did not verify: Full runtime execution of all affected plugins in a live OpenClaw environment, as this is a simulated interaction.

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

List only real risks for this PR. Add/remove entries as needed. If none, write None.

  • Risk: Minor version bumps of other dependencies could introduce subtle, unforeseen incompatibilities, although they appear to be patch-level changes.
    • Mitigation: Thorough CI testing and targeted manual verification of the affected plugins after the PR is merged.

Changed files

  • extensions/acpx/package.json (modified, +4/-2)
  • extensions/discord/package.json (modified, +5/-3)
  • extensions/nostr/package.json (modified, +3/-1)
  • extensions/slack/package.json (modified, +3/-1)
  • extensions/telegram/package.json (modified, +4/-2)

Code Example

[channels] failed to load bundled channel telegram: Cannot find module 'grammy'
Require stack:
- <openclaw package root>/dist/extensions/telegram/send-*.js

---

openclaw cron list
openclaw doctor
openclaw completion --help

---

{
  "installRootExternal": true,
  "missing": [],
  "conflicts": [],
  "missingSpecs": [],
  "warnings": []
}

---

grammy => ~/.openclaw/plugin-runtime-deps/openclaw-2026.4.29-*/node_modules/grammy/out/mod.js
@grammyjs/runner => ~/.openclaw/plugin-runtime-deps/openclaw-2026.4.29-*/node_modules/@grammyjs/runner/out/mod.js
@grammyjs/transformer-throttler => ~/.openclaw/plugin-runtime-deps/openclaw-2026.4.29-*/node_modules/@grammyjs/transformer-throttler/dist/mod.js

---

grammy MISSING MODULE_NOT_FOUND
@grammyjs/runner MISSING MODULE_NOT_FOUND
@grammyjs/transformer-throttler MISSING MODULE_NOT_FOUND

---

import * as grammy from "grammy";
import { Bot, HttpError } from "grammy";
RAW_BUFFERClick to expand / collapse

Summary

After updating an npm/pnpm OpenClaw install to 2026.4.29, several CLI commands complete successfully but print repeated warnings like:

[channels] failed to load bundled channel telegram: Cannot find module 'grammy'
Require stack:
- <openclaw package root>/dist/extensions/telegram/send-*.js

The running gateway is healthy and Telegram works. openclaw plugins deps --json reports the Telegram runtime dependencies are installed under the external plugin runtime-deps root with no missing deps or conflicts.

This looks like a CLI-side bundled runtime dependency resolution issue: CLI code paths import the Telegram ESM bundle directly, and that bundle has bare ESM imports such as import "grammy". The deps exist in the staged runtime-deps root, but Node ESM does not resolve bare imports through NODE_PATH, so CLI commands emit the warning even though the gateway runtime can stage/use the deps.

Environment

  • OpenClaw: 2026.4.29 (a448042)
  • Install kind: package / pnpm
  • OS: Linux x64
  • Node: v25.9.0
  • Gateway: systemd user service, loopback bind
  • Telegram: configured and healthy in openclaw status --deep

Reproduction / observed commands

Commands that print the warning while otherwise succeeding:

openclaw cron list
openclaw doctor
openclaw completion --help

openclaw cron list still prints the expected result, e.g. No cron jobs., then prints the Telegram grammy warning.

Runtime deps inspection

openclaw plugins deps --json shows:

{
  "installRootExternal": true,
  "missing": [],
  "conflicts": [],
  "missingSpecs": [],
  "warnings": []
}

And the Telegram deps are resolvable from the staged runtime-deps root:

grammy => ~/.openclaw/plugin-runtime-deps/openclaw-2026.4.29-*/node_modules/grammy/out/mod.js
@grammyjs/runner => ~/.openclaw/plugin-runtime-deps/openclaw-2026.4.29-*/node_modules/@grammyjs/runner/out/mod.js
@grammyjs/transformer-throttler => ~/.openclaw/plugin-runtime-deps/openclaw-2026.4.29-*/node_modules/@grammyjs/transformer-throttler/dist/mod.js

But they are not resolvable from the package root itself:

grammy MISSING MODULE_NOT_FOUND
@grammyjs/runner MISSING MODULE_NOT_FOUND
@grammyjs/transformer-throttler MISSING MODULE_NOT_FOUND

The Telegram plugin bundle has direct ESM imports:

import * as grammy from "grammy";
import { Bot, HttpError } from "grammy";

Expected behavior

CLI commands that need channel metadata/send helpers should resolve bundled runtime deps the same way the gateway/runtime path does, or avoid importing channel modules that require staged deps for unrelated commands.

Actual behavior

CLI commands succeed but emit repeated noisy warnings about missing grammy, even though plugins deps says dependencies are installed and the running Telegram gateway is healthy.

Impact

Low operational impact, but confusing after update and makes doctor/cron/completion output look broken. It also obscures real warnings.

extent analysis

TL;DR

The issue can be resolved by modifying the CLI code to properly resolve bundled runtime dependencies, potentially by using a custom resolver or adjusting the import paths.

Guidance

  • Verify that the NODE_PATH environment variable is not being used to resolve dependencies, as Node ESM does not support this.
  • Investigate using a custom resolver or adjusting the import paths in the CLI code to match the gateway/runtime path.
  • Consider using a tool like pnpm or npm to manage dependencies and ensure that the grammy package is installed and resolvable.
  • Review the openclaw code to ensure that the Telegram plugin bundle is being loaded correctly and that the dependencies are being resolved as expected.

Example

// Potential example of using a custom resolver
import { createRequire } from 'module';
const require = createRequire(import.meta.url);
const grammy = require('grammy');

Note: This example is speculative and may not be the exact solution, but it illustrates the idea of using a custom resolver.

Notes

The issue seems to be related to the difference in how the gateway/runtime path and the CLI code resolve dependencies. The openclaw code may need to be modified to ensure that the dependencies are resolved correctly.

Recommendation

Apply a workaround by modifying the CLI code to properly resolve bundled runtime dependencies, as the issue is likely related to the custom import paths and resolver used by the openclaw code.

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

CLI commands that need channel metadata/send helpers should resolve bundled runtime deps the same way the gateway/runtime path does, or avoid importing channel modules that require staged deps for unrelated commands.

Still need to ship something?

×6

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

Back to top recommendations

TRENDING