openclaw - 💡(How to fix) Fix [Bug] 2026.4.26: sharp not installed with media-understanding-core extension — image optimization fails [1 comments, 2 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#73224Fetched 2026-04-29 06:22:04
View on GitHub
Comments
1
Participants
2
Timeline
2
Reactions
0
Author
Participants
Timeline (top)
closed ×1commented ×1

Error Message

The media-understanding-core extension (new in 2026.4.26) declares sharp as a runtime dependency, but sharp is not installed when upgrading from 2026.4.25 via npm update. This causes image optimization to fail for all image-sending operations (message tool sending images to Telegram, etc.) with the error: Failed to optimize image.

Error Log

The error originates in web-media-<hash>.js optimizeImageToJpeg()loadMediaAttachmentImageOps() which loads sharp from media-understanding-core/image-ops.js. The loadSharp() function does import('sharp') which throws MODULE_NOT_FOUND since sharp is not in the npm tree.

Root Cause

The media-understanding-core extension is new in 2026.4.26. Its package.json declares:

"dependencies": {
  "sharp": "^0.34.5"
}

However, the npm global update (npm i -g openclaw@latest) did not install this dependency into the extension's node_modules or the main OpenClaw node_modules. The postinstall-inventory mechanism (dist/postinstall-inventory.json) tracks dist/extensions/media-understanding-core/image-ops.js but apparently did not trigger sharp's installation.

Fix Action

Workaround

Manually install sharp into the OpenClaw installation:

cd /path/to/openclaw && npm install sharp@^0.34.5 --no-fund --no-audit

Then restart the gateway.

Code Example

[tools] image_generate failed: Failed to optimize image raw_params={"prompt":"...","media":"/path/to/media/image.png","target":"8703284429"}
[tools] message failed: Failed to optimize image raw_params={"action":"send","media":"/path/to/media/image.png","target":"8703284429"}

---

"dependencies": {
  "sharp": "^0.34.5"
}

---

cd /path/to/openclaw && npm install sharp@^0.34.5 --no-fund --no-audit
RAW_BUFFERClick to expand / collapse

Bug Description

The media-understanding-core extension (new in 2026.4.26) declares sharp as a runtime dependency, but sharp is not installed when upgrading from 2026.4.25 via npm update. This causes image optimization to fail for all image-sending operations (message tool sending images to Telegram, etc.) with the error: Failed to optimize image.

Steps to Reproduce

  1. Upgrade from 2026.4.25 to 2026.4.26 via openclaw update (npm global update)
  2. Any agent attempts to send a generated image via Telegram
  3. Image generation succeeds but the message tool fails with Failed to optimize image

Environment

  • OpenClaw version: 2026.4.26 (be8c246)
  • Node.js: v24.14.1
  • Platform: Linux (WSL2)
  • Extension: @openclaw/media-understanding-core (new in 2026.4.26)
  • Dependency declared: sharp@^0.34.5 in dist/extensions/media-understanding-core/package.json

Error Log

[tools] image_generate failed: Failed to optimize image raw_params={"prompt":"...","media":"/path/to/media/image.png","target":"8703284429"}
[tools] message failed: Failed to optimize image raw_params={"action":"send","media":"/path/to/media/image.png","target":"8703284429"}

The error originates in web-media-<hash>.js optimizeImageToJpeg()loadMediaAttachmentImageOps() which loads sharp from media-understanding-core/image-ops.js. The loadSharp() function does import('sharp') which throws MODULE_NOT_FOUND since sharp is not in the npm tree.

Root Cause

The media-understanding-core extension is new in 2026.4.26. Its package.json declares:

"dependencies": {
  "sharp": "^0.34.5"
}

However, the npm global update (npm i -g openclaw@latest) did not install this dependency into the extension's node_modules or the main OpenClaw node_modules. The postinstall-inventory mechanism (dist/postinstall-inventory.json) tracks dist/extensions/media-understanding-core/image-ops.js but apparently did not trigger sharp's installation.

Workaround

Manually install sharp into the OpenClaw installation:

cd /path/to/openclaw && npm install sharp@^0.34.5 --no-fund --no-audit

Then restart the gateway.

Expected Behavior

Image optimization should work out-of-the-box after upgrading. The media-understanding-core extension's sharp dependency should be installed automatically during openclaw update.

Additional Context

  • No prior issues with image sending (this is the first version with media-understanding-core)
  • Verified: after manually installing sharp, image optimization works correctly (tested resize of 864x1152 JPEG → 35KB in <1s)
  • This was first reported after upgrading from 2026.4.25 → 2026.4.26

extent analysis

TL;DR

Manually installing sharp into the OpenClaw installation may resolve the image optimization failure.

Guidance

  • Verify that sharp is not installed in the OpenClaw node_modules by checking the directory contents.
  • Run the provided workaround command: cd /path/to/openclaw && npm install sharp@^0.34.5 --no-fund --no-audit to install sharp.
  • Restart the gateway after installing sharp to ensure the changes take effect.
  • If issues persist, check the postinstall-inventory.json mechanism to ensure it is correctly tracking dependencies.

Example

cd /path/to/openclaw && npm install sharp@^0.34.5 --no-fund --no-audit

Notes

This workaround may not be a permanent solution, as the media-understanding-core extension's sharp dependency should be installed automatically during openclaw update. The root cause of the issue seems to be related to the postinstall-inventory mechanism not triggering the installation of sharp.

Recommendation

Apply the workaround by manually installing sharp into the OpenClaw installation, as it has been verified to resolve the image optimization issue.

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…

Still need to ship something?

×6

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

Back to top recommendations

TRENDING

openclaw - 💡(How to fix) Fix [Bug] 2026.4.26: sharp not installed with media-understanding-core extension — image optimization fails [1 comments, 2 participants]