langgenius/dify · error · ValueError

NEW_USER_DEFAULT_MODELS entries must use 'model_type:provide

Error message

NEW_USER_DEFAULT_MODELS entries must use 'model_type:provider:model' format

What it means

Raised by the NEW_USER_DEFAULT_MODEL_LIST property when a comma-separated NEW_USER_DEFAULT_MODELS entry does not split into exactly three non-empty parts via item.split(':', 2). The expected format is 'model_type:provider:model'; fewer than three colons-separated parts, empty parts, or trailing colons trigger it.

Source

Thrown at api/configs/feature/__init__.py:331

        return [item.strip() for item in self.NEW_USER_DEFAULT_PLUGIN_IDS.split(",") if item.strip()]

    NEW_USER_DEFAULT_MODELS: str = Field(
        description=("Comma-separated default models for new users in 'model_type:provider:model' format"),
        default="",
    )

    @property
    def NEW_USER_DEFAULT_MODEL_LIST(self) -> list[tuple[str, str, str]]:
        default_models: list[tuple[str, str, str]] = []
        configured_model_types: set[str] = set()

        for item in self.NEW_USER_DEFAULT_MODELS.split(","):
            if not item.strip():
                continue

            parts = tuple(part.strip() for part in item.split(":", 2))
            if len(parts) != 3 or not all(parts):
                raise ValueError("NEW_USER_DEFAULT_MODELS entries must use 'model_type:provider:model' format")

            model_type, provider, model = parts
            if model_type in configured_model_types:
                raise ValueError(f"NEW_USER_DEFAULT_MODELS contains duplicate model type: {model_type}")

            configured_model_types.add(model_type)
            default_models.append((model_type, provider, model))

        return default_models


class MarketplaceConfig(BaseSettings):
    """
    Configuration for marketplace
    """

    MARKETPLACE_ENABLED: bool = Field(
        description="Enable or disable marketplace",

View on GitHub (pinned to ef8544b173)

Solutions

  1. Format each entry as model_type:provider:model, e.g. 'llm:openai:gpt-4o'.
  2. Separate multiple entries with commas; ensure no empty segments between colons.
  3. Use a recognized model_type (typically 'llm' / 'text-to-speech' etc. per the app's enum).

Example fix

// before
NEW_USER_DEFAULT_MODELS=llm:openai
// after
NEW_USER_DEFAULT_MODELS=llm:openai:gpt-4o
Defensive patterns

Strategy: validation

Validate before calling

def valid_default_model_entry(entry: str) -> bool:
    parts = tuple(p.strip() for p in entry.split(':', 2))
    return len(parts) == 3 and all(parts)

Prevention

When it happens

Trigger: Setting NEW_USER_DEFAULT_MODELS='llm:openai' (missing model), 'llm::gpt-4' (empty provider), 'chat-model' (no colons), or 'llm:openai:gpt-4:extra' (split with maxsplit=2 yields 3 parts but the third contains a colon — actually passes; failing case is <3 parts or empty parts).

Common situations: Wrong delimiter (using ';' or '|'), missing a segment, or copy-pasting a model name that omits the provider.

Related errors


AI-assisted analysis of langgenius/dify@ef8544b173 (2026-08-12). Data as JSON: /api/errors/7dd976818dce84fa. Report an issue: GitHub.