# 更新到最新版后，部分用户头像变回默认图片，无法上传新头像，日志显示转换错误

**URL:** <https://meta.discourse.org/t/failed-to-optimize-image-error-from-discourse-topic-previews-sidecar/408911>\
**Category:** Support\
**Created:** [2026年七月30日 12:27 UTC](https://meta.discourse.org/t/failed-to-optimize-image-error-from-discourse-topic-previews-sidecar/408911 "2026-07-30T12:27:44Z")\
**Posts on this page:** 1\
**Showing post:** 1

<div class="post-metadata">

**Author:** ![Takiro](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/takiro/32/572426_2.png) [@Takiro](https://meta.discourse.org/u/Takiro)\
**Post date:** [2026年七月30日 12:27 UTC](https://meta.discourse.org/t/failed-to-optimize-image-error-from-discourse-topic-previews-sidecar/408911/1 "2026-07-30T12:27:44Z")

</div>

几天前，我将 Discourse 更新到了 v2026.8.0-latest 版本。一些用户的头像变成了默认图片（不是字母头像）。尝试上传新图片没有任何反应。预览显示了图片，但保存后又会变回默认图片。无论是用户还是管理员操作都如此。界面没有显示任何错误消息。

首先，我尝试用 rake 刷新头像，但这没有起到任何作用。然后我检查了日志，查看在尝试更改头像图片时是否有任何显示，我发现了以下日志消息：

> 图片优化失败：原因未知 upload\_id: 位置: {raise\_on\_error: true, quality: 90, upload\_id: 235861} 错误消息: 无法将 Hash 隐式转换为 String 指令: [“convert”, “png:/var/www/discourse/public/uploads/default/original/3X/2/c/2c620efd4ee10548884a11b7237d5aa9135817b1.png[0]”, “-quality”, “90”, “-auto-orient”, “-gravity”, “center”, “-background”, “transparent”, “-thumbnail”, “24x24^”, “-extent”, “24x24”, “-interpolate”, “catrom”, “-unsharp”, “2x0.5+0.7+0”, “-interlace”, “none”, “-profile”, “/var/www/discourse/vendor/data/RT\_sRGB.icm”, “png:/tmp/discourse-thumbnail20260730-360984-9yk3a1.png”]
> 
> 发送文件 /var/www/discourse/public/images/avatar.png (0.3ms)

所以，我猜测处理图片优化的代码中存在类型不匹配的问题。

有趣的是，我也无法在这个论坛上上传头像，怀疑这里也发生了类似的事情。至少在这里我会收到一条关于“出了点问题”的错误消息。

有什么办法可以解决这个问题吗，还是我只能等待修复？

---

_[View the full topic](https://meta.discourse.org/t/failed-to-optimize-image-error-from-discourse-topic-previews-sidecar/408911)._
