[PR #32209] fix: convert UUID to str in deleted_tools API provider check #33608

Closed
opened 2026-02-21 20:53:35 -05:00 by yindo · 0 comments
Owner

Original Pull Request: https://github.com/langgenius/dify/pull/32209

State: closed
Merged: No


Summary

Fix a type mismatch bug where all API tool providers are incorrectly marked as deleted in the deleted_tools property.

Problem

api_provider.id returns a uuid.UUID object from SQLAlchemy, but provider_id from the app JSON config is a str. Since "abc" != UUID("abc") in Python, the in check always fails, causing every API tool to appear as "removed" in the UI.

Fix

Cast api_provider.id to str() so the type comparison works correctly.

existing_api_providers = [
-    api_provider.id
+    str(api_provider.id)
    for api_provider in session.execute(...)
]

Verification

As reported in the issue: before fix 44 tools marked deleted, after fix 0.

Closes #32205

Disclosure: AI-assisted identification of the fix pattern.

**Original Pull Request:** https://github.com/langgenius/dify/pull/32209 **State:** closed **Merged:** No --- ## Summary Fix a type mismatch bug where all API tool providers are incorrectly marked as deleted in the `deleted_tools` property. ## Problem `api_provider.id` returns a `uuid.UUID` object from SQLAlchemy, but `provider_id` from the app JSON config is a `str`. Since `"abc" != UUID("abc")` in Python, the `in` check always fails, causing every API tool to appear as "removed" in the UI. ## Fix Cast `api_provider.id` to `str()` so the type comparison works correctly. ```diff existing_api_providers = [ - api_provider.id + str(api_provider.id) for api_provider in session.execute(...) ] ``` ## Verification As reported in the issue: before fix 44 tools marked deleted, after fix 0. Closes #32205 **Disclosure**: AI-assisted identification of the fix pattern.
yindo added the pull-request label 2026-02-21 20:53:35 -05:00
yindo closed this issue 2026-02-21 20:53:35 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify#33608