{"record":{"id":"4cbf5ef046dfd3dc","repo":"langgenius/dify","slug":"new-user-default-models-contains-duplicate-model-t","errorCode":null,"errorMessage":"NEW_USER_DEFAULT_MODELS contains duplicate model type: {model_type}","messagePattern":"NEW_USER_DEFAULT_MODELS contains duplicate model type: (.+?)","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"api/configs/feature/__init__.py","lineNumber":335,"sourceCode":"        default=\"\",\n    )\n\n    @property\n    def NEW_USER_DEFAULT_MODEL_LIST(self) -> list[tuple[str, str, str]]:\n        default_models: list[tuple[str, str, str]] = []\n        configured_model_types: set[str] = set()\n\n        for item in self.NEW_USER_DEFAULT_MODELS.split(\",\"):\n            if not item.strip():\n                continue\n\n            parts = tuple(part.strip() for part in item.split(\":\", 2))\n            if len(parts) != 3 or not all(parts):\n                raise ValueError(\"NEW_USER_DEFAULT_MODELS entries must use 'model_type:provider:model' format\")\n\n            model_type, provider, model = parts\n            if model_type in configured_model_types:\n                raise ValueError(f\"NEW_USER_DEFAULT_MODELS contains duplicate model type: {model_type}\")\n\n            configured_model_types.add(model_type)\n            default_models.append((model_type, provider, model))\n\n        return default_models\n\n\nclass MarketplaceConfig(BaseSettings):\n    \"\"\"\n    Configuration for marketplace\n    \"\"\"\n\n    MARKETPLACE_ENABLED: bool = Field(\n        description=\"Enable or disable marketplace\",\n        default=True,\n    )\n\n    MARKETPLACE_API_URL: HttpUrl = Field(","sourceCodeStart":317,"sourceCodeEnd":353,"githubUrl":"https://github.com/langgenius/dify/blob/ef8544b173fd6cd7a8e71df2cab576e52bebbfbc/api/configs/feature/__init__.py#L317-L353","documentation":"Raised by NEW_USER_DEFAULT_MODEL_LIST when two entries share the same model_type (first segment). The default-models logic reserves one default per model type, so duplicates would non-deterministically override each other at app-provisioning time.","triggerScenarios":"Setting NEW_USER_DEFAULT_MODELS='llm:openai:gpt-4o,llm:anthropic:claude-3' — both entries have model_type 'llm'.","commonSituations":"Wanting to default multiple providers for the same type; misunderstanding that the keying is by model_type, not by provider.","solutions":["Keep at most one entry per model_type (e.g. only one 'llm' entry).","If you need multiple LLMs, set them per-workspace after provisioning rather than in NEW_USER_DEFAULT_MODELS.","Switch the second entry to a different model_type if a second default category is intended."],"exampleFix":"// before\nNEW_USER_DEFAULT_MODELS=llm:openai:gpt-4o,llm:anthropic:claude-3\n// after\nNEW_USER_DEFAULT_MODELS=llm:openai:gpt-4o","handlingStrategy":"validation","validationCode":"def no_duplicate_model_type(entries: str) -> bool:\n    types = [e.split(':', 1)[0].strip() for e in entries.split(',') if e.strip()]\n    return len(types) == len(set(types))","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Allow only one entry per model_type.","Set additional models per-workspace after provisioning.","Lint NEW_USER_DEFAULT_MODELS for duplicate first segments in CI."],"tags":["config","pydantic","model-defaults","validation"],"backgroundTag":null,"analyzedSha":"ef8544b173fd6cd7a8e71df2cab576e52bebbfbc","analyzedAt":"2026-08-12T05:15:17.394Z","schemaVersion":2},"datasetVersion":"2026-08-12T13:17:24.610Z"}