bug: plugin upgrade fails when .difypkg file missing from disk (PVC recreation)
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
- #34490 @euxx による — マージされずにクローズ
評価
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 初心者へのやさしさ
- 52/100
- issue の種類
- バグ
- 明瞭さ
- おおむね明確
- 活発さ
- 静か
- 領域
- api, backend, infrastructure
調査の方向性
api/services/plugin/plugin_service.py の PluginService.upgrade_plugin_with_marketplace() と、api/tasks/process_tenant_plugin_autoupgrade_check_task.py の process_tenant_plugin_autoupgrade_check_task() から始めます。decode_plugin_from_identifier() がパッケージをどのように確認し、download_plugin_pkg() と upload_pkg() がどのように使われているかを追跡します。両方のアップグレードパスで不足している .difypkg ファイルを再ダウンロードし、アップグレードを完了できれば完了です。
索引モデルが issue の本文から書いたものです。
説明
Self Checks
- I have read the Contributing Guide and Language Policy.
- This is only for bug report, if you would like to ask a question, please head to Discussions.
- I have searched for existing issues search for existing issues, including closed ones.
- I confirm that I am using English to submit this report, otherwise it will be closed.
- Please do not modify this template :) and fill in all the required fields.
Dify version
1.13.2 (also confirmed on latest main)
Cloud or Self Hosted
Self Hosted (Kubernetes)
Steps to reproduce
- Install several plugins from the Marketplace (e.g. openai, anthropic, deepseek, etc.)
- Delete or recreate the PVC backing
/app/storage/plugin_packages/on the plugin-daemon pod (simulating storage loss, node migration, or PVC reprovisioning) - Restart the plugin-daemon pod
- Wait for the periodic plugin auto-upgrade check to run (
process_tenant_plugin_autoupgrade_check_task), or trigger a manual upgrade from the UI
✔️ Expected Behavior
When the .difypkg file is missing from disk, the upgrade flow should detect this and re-download the package from the Marketplace, even if the DB/Redis declaration still exists.
❌ Actual Behavior
All plugins that had their package files removed show the error:
failed to move plugin to installed bucket: failed to get package file when trying to install plugin to local
open /app/storage/plugin_packages/langgenius/openai:0.3.4@3345b59...: no such file or directory
This affects every plugin whose .difypkg file was lost. In our case, 30+ plugins were affected simultaneously after a PVC recreation.
Root Cause
There are two affected code paths:
1. UI manual upgrade — PluginService.upgrade_plugin_with_marketplace() in api/services/plugin/plugin_service.py:
try:
manager.fetch_plugin_manifest(tenant_id, new_plugin_unique_identifier)
# already downloaded, skip
marketplace.record_install_plugin_event(new_plugin_unique_identifier)
except Exception:
pkg = download_plugin_pkg(new_plugin_unique_identifier)
...
fetch_plugin_manifest only queries the daemon DB for a PluginDeclaration record — it does not verify the .difypkg file on disk. When the file is missing but the DB record remains, the try block succeeds, the download is skipped, and the upgrade fails.
2. Auto-upgrade celery task — process_tenant_plugin_autoupgrade_check_task() in api/tasks/process_tenant_plugin_autoupgrade_check_task.py:
This task calls manager.upgrade_plugin() directly without any file existence check at all. It never verifies that the package file is present before asking the daemon to perform the upgrade.
Proposed Fix
Add decode_plugin_from_identifier() calls to verify the package file exists on disk before proceeding with upgrades:
Path 1 — plugin_service.py: Add a decode_plugin_from_identifier call after fetch_plugin_manifest:
try:
manager.fetch_plugin_manifest(tenant_id, new_plugin_unique_identifier)
manager.decode_plugin_from_identifier(tenant_id, new_plugin_unique_identifier)
marketplace.record_install_plugin_event(new_plugin_unique_identifier)
except Exception:
pkg = download_plugin_pkg(new_plugin_unique_identifier)
...
Path 2 — auto-upgrade task: Add decode check + download fallback before upgrade_plugin():
try:
manager.decode_plugin_from_identifier(tenant_id, new_unique_identifier)
except Exception:
pkg = download_plugin_pkg(new_unique_identifier)
manager.upload_pkg(tenant_id, pkg, verify_signature=False)
manager.upgrade_plugin(...)
decode_plugin_from_identifier calls the daemon's GetPackage() which reads the actual file, so it raises an exception if the file is missing, triggering the re-download.
- 主要言語
- Go
- スター
- 462
- フォーク
- 326
- 平均マージ
- 22時間 15分
- マージ済み PR(30日)
- 8
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドなし
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
langgenius/dify-plugin-daemon のほかの issue
-
Agent strategy run cut by PLUGIN_MAX_EXECUTION_TIMEOUT is reported only as "Internal Server Error"オープン
難易度 3/5 1〜2日 初心者へのやさしさ 62/100
langgenius/dify-plugin-daemon#863 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 3/5 1〜2日 初心者へのやさしさ 35/100
langgenius/dify-plugin-daemon#862 ·
メンテナーはふだん 1 日以内に返信
-
fix(install): prevent mirror settings from changing dependency resolution inputs対応中かも @WH-2099 が 5 日前に担当しました。 オープンproject#dify-plugin-daemon
langgenius/dify-plugin-daemon#860 · 担当者 1 名 ·
メンテナーはふだん 1 日以内に返信
-
READONLY error when using Redis 6.2.2 Sentinel cluster on Kubernetes with dify-plugin-daemon 0.6.10-local対応中かも @Souravrajvi0 が 60 日前に担当しました。 オープン
難易度 4/5 3〜5日 初心者へのやさしさ 45/100
langgenius/dify-plugin-daemon#826 · コメント 2 件 ·
メンテナーはふだん 1 日以内に返信
-
uninstall the plugin, but the plugin package is not removed対応中かも @fatelei が 111 日前に担当しました。 オープンbug plugin-daemon
難易度 3/5 1〜2日 初心者へのやさしさ 38/100
langgenius/dify-plugin-daemon#797 · コメント 2 件 ·
メンテナーはふだん 1 日以内に返信
langgenius/dify-plugin-daemon の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
メンテナーはふだん 1 日以内に返信
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 66/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
github/github-mcp-server#3960 ·
メンテナーはふだん 3 日以内に返信
-
難易度 1/5 1時間未満 初心者へのやさしさ 78/100
JuliusBrussee/caveman#1594 ·
メンテナーはふだん 1 日以内に返信
-
C-bug O-community X-blathers-triaged
難易度 2/5 1〜3時間 初心者へのやさしさ 66/100
cockroachdb/cockroach#176264 · コメント 1 件 ·