openclaw - ✅(Solved) Fix [Bug]: Sharp prebuilt binary fails on Common KVM / SSE2-only CPU (N355) — recurring "Failed to optimize image" after every update [1 pull requests, 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#75634Fetched 2026-05-02 05:32:31
View on GitHub
Comments
1
Participants
2
Timeline
4
Reactions
2
Author
Timeline (top)
labeled ×2commented ×1cross-referenced ×1

On virtualized Common KVM processor (SSE2 only, no v2 microarchitecture), Sharp’s prebuilt linux-x64 binaries fail to load. Image optimization throws "Failed to optimize image". Custom try/catch + libvips fallback works but is overwritten on every openclaw update.

Error Message

Error: "Failed to optimize image" when Sharp cannot load prebuilt binary. CPU: Common KVM processor (family 15, SSE2 only). Patch location: dist/image-ops-*.js (try/catch + vipsthumbnail fallback). vipsthumbnail version: v8.15.1 at /usr/bin/vipsthumbnail. Timeline: Patch applied 2026-04-15, confirmed working, overwritten on updates.

Root Cause

This is a recurring compatibility issue with Sharp’s prebuilts on virtualized CPUs lacking v2 microarchitecture. The libvips CLI fallback is reliable but fragile because it lives in dist/. Last known good workaround: custom patch applied 2026-04-15.

Fix Action

Fix / Workaround

  1. Run OpenClaw on Proxmox VM with Common KVM processor (Intel N355 host, virtualized).
  2. Upload any image via WebUI or agent.
  3. Observe "Failed to optimize image" error (Sharp cannot load prebuilt binary).
  4. Apply custom patch in dist/image-ops-*.js (try/catch around sharp.resizeToJpeg + fallback to /usr/bin/vipsthumbnail).
  5. Run openclaw update — patch is overwritten and error returns.

Image optimization works out-of-the-box on common virtualized CPUs (or gracefully falls back without manual patching after updates).

Sharp fails due to missing v2 instructions. Manual patch required after every update. Patch survives only until next update.

PR fix notes

PR #75732: fix: graceful Sharp fallback to libvips on SSE2-only CPUs

Description (problem / solution / changelog)

Summary

When Sharp's prebuilt linux-x64 binary fails to load (e.g. on virtualized SSE2-only CPUs like Intel N355 in Common KVM), image optimization now gracefully falls back to libvips CLI (vipsthumbnail) instead of throwing a generic "Failed to optimize image" error. This fallback works out-of-the-box and survives OpenClaw updates.

Changes

  • Added prefersVips() helper that returns true on Linux x64 when OPENCLAW_IMAGE_BACKEND is not explicitly set to sharp or sips
  • Added isVipsAvailable() check that verifies /usr/bin/vipsthumbnail exists before attempting fallback
  • Added vipsResizeToJpeg() that uses vipsthumbnail to resize and convert images to JPEG
  • Modified resizeToJpeg() to catch Sharp load failures on Linux x64 and fall back to vipsthumbnail when available
  • Fallback path: write buffer to temp file → run vipsthumbnail -s N -Q quality input -o output → read result

Testing

Tested on Proxmox VM with Intel N355 (Common KVM, SSE2-only). Image uploads now succeed where before they threw "Failed to optimize image".

Fixes openclaw/openclaw#75634

Changed files

  • src/media/image-ops.ts (modified, +65/-2)

Code Example

Error: "Failed to optimize image" when Sharp cannot load prebuilt binary.
CPU: Common KVM processor (family 15, SSE2 only).
Patch location: dist/image-ops-*.js (try/catch + vipsthumbnail fallback).
vipsthumbnail version: v8.15.1 at /usr/bin/vipsthumbnail.
Timeline: Patch applied 2026-04-15, confirmed working, overwritten on updates.
RAW_BUFFERClick to expand / collapse

Bug type

Regression (worked before, now fails)

Beta release blocker

No

Summary

On virtualized Common KVM processor (SSE2 only, no v2 microarchitecture), Sharp’s prebuilt linux-x64 binaries fail to load. Image optimization throws "Failed to optimize image". Custom try/catch + libvips fallback works but is overwritten on every openclaw update.

Steps to reproduce

  1. Run OpenClaw on Proxmox VM with Common KVM processor (Intel N355 host, virtualized).
  2. Upload any image via WebUI or agent.
  3. Observe "Failed to optimize image" error (Sharp cannot load prebuilt binary).
  4. Apply custom patch in dist/image-ops-*.js (try/catch around sharp.resizeToJpeg + fallback to /usr/bin/vipsthumbnail).
  5. Run openclaw update — patch is overwritten and error returns.

Expected behavior

Image optimization works out-of-the-box on common virtualized CPUs (or gracefully falls back without manual patching after updates).

Actual behavior

Sharp fails due to missing v2 instructions. Manual patch required after every update. Patch survives only until next update.

OpenClaw version

2026.4.23 (daily driver); reproduced on all newer versions tested.

Operating system

Ubuntu VM in Proxmox (host: Intel N355 mini PC, Common KVM processor)

Install method

Official release, started via openclaw / systemd service.

Model

qwen3.6-27b, chatgpt5.5,all

Provider / routing chain

(issue is independent of model)

Additional provider/model setup details

N/A

Logs, screenshots, and evidence

Error: "Failed to optimize image" when Sharp cannot load prebuilt binary.
CPU: Common KVM processor (family 15, SSE2 only).
Patch location: dist/image-ops-*.js (try/catch + vipsthumbnail fallback).
vipsthumbnail version: v8.15.1 at /usr/bin/vipsthumbnail.
Timeline: Patch applied 2026-04-15, confirmed working, overwritten on updates.

Impact and severity

Affected: All image uploads / media processing on virtualized low-power CPUs. Severity: Annoying (requires manual re-patching after every update). Frequency: Every image upload + every update. Consequence: Broken image features until manual intervention.

Additional information

This is a recurring compatibility issue with Sharp’s prebuilts on virtualized CPUs lacking v2 microarchitecture. The libvips CLI fallback is reliable but fragile because it lives in dist/. Last known good workaround: custom patch applied 2026-04-15.

extent analysis

TL;DR

Apply a custom patch with a try/catch block around sharp.resizeToJpeg and fallback to /usr/bin/vipsthumbnail to mitigate the "Failed to optimize image" error.

Guidance

  • Identify the specific line of code in dist/image-ops-*.js where the Sharp library is used for image optimization and wrap it with a try/catch block.
  • In the catch block, use the /usr/bin/vipsthumbnail command as a fallback for image optimization.
  • Verify that the vipsthumbnail version is compatible with the system (currently v8.15.1).
  • Consider modifying the OpenClaw update process to preserve custom patches or exploring alternative image optimization libraries that support virtualized CPUs without v2 microarchitecture.

Example

try {
  // Sharp library code for image optimization
  sharp.resizeToJpeg(...);
} catch (error) {
  // Fallback to vipsthumbnail
  exec('/usr/bin/vipsthumbnail ...');
}

Notes

The custom patch may need to be reapplied after every OpenClaw update, which can be inconvenient. A more permanent solution might involve modifying the OpenClaw codebase or using a different image optimization library.

Recommendation

Apply workaround: use the custom patch with try/catch and vipsthumbnail fallback, as it provides a reliable solution for image optimization on virtualized CPUs lacking v2 microarchitecture, despite requiring manual reapplication after updates.

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

Image optimization works out-of-the-box on common virtualized CPUs (or gracefully falls back without manual patching after updates).

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 - ✅(Solved) Fix [Bug]: Sharp prebuilt binary fails on Common KVM / SSE2-only CPU (N355) — recurring "Failed to optimize image" after every update [1 pull requests, 1 comments, 2 participants]