dify - 💡(How to fix) Fix Legacy model_type values break custom model credential management [1 pull requests]

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…

Custom model credential management breaks for workspaces that still have legacy model_type values in provider-related tables. Requests with canonical query values such as model_type=llm can return Credential with id ... not found, which prevents users from loading, updating, switching, or deleting OpenAI-compatible custom model credentials.

Root Cause

The EnumText(ModelType) migration removed legacy query normalization from several read paths while keeping only result deserialization compatibility.

ModelType.value_of("text-generation") still deserializes legacy rows to ModelType.LLM, but SQL bind parameters are emitted as canonical values such as llm. Rows that still store legacy values such as text-generation or embeddings are therefore skipped by read queries.

The regression affects mixed datasets in tables including:

  • provider_models
  • tenant_default_models
  • provider_model_settings
  • provider_model_credentials
  • load_balancing_model_configs

Fix Action

Fixed

RAW_BUFFERClick to expand / collapse

AI disclosure: This issue was drafted and analyzed with Codex using GPT-5.4. I have reviewed the analysis, and I am responsible for the content.

Summary

Custom model credential management breaks for workspaces that still have legacy model_type values in provider-related tables. Requests with canonical query values such as model_type=llm can return Credential with id ... not found, which prevents users from loading, updating, switching, or deleting OpenAI-compatible custom model credentials.

Root cause

The EnumText(ModelType) migration removed legacy query normalization from several read paths while keeping only result deserialization compatibility.

ModelType.value_of("text-generation") still deserializes legacy rows to ModelType.LLM, but SQL bind parameters are emitted as canonical values such as llm. Rows that still store legacy values such as text-generation or embeddings are therefore skipped by read queries.

The regression affects mixed datasets in tables including:

  • provider_models
  • tenant_default_models
  • provider_model_settings
  • provider_model_credentials
  • load_balancing_model_configs

Reproduction

  1. Persist a custom model credential row with provider_model_credentials.model_type = 'text-generation'.
  2. Open the custom model credential endpoint with model_type=llm.
  3. Observe Credential with id ... not found.

Impact

  • Users cannot load, update, switch, or delete affected custom model credentials.
  • Available credential lists can appear empty.
  • Default model and load balancing lookups can also miss legacy rows.

Proposed fix

Use a shared read-path helper that matches both canonical and legacy model_type values during queries, while keeping new writes on canonical enum values.

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