{"record":{"id":"1ebbfa1e47e3aa4e","repo":"harry0703/MoneyPrinterTurbo","slug":"llm-provider-model-name-is-not-set-please-set","errorCode":null,"errorMessage":"{llm_provider}: model_name is not set, please set it in the config.toml file.","messagePattern":"(.+?): model_name is not set, please set it in the config\\.toml file\\.","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"app/services/llm.py","lineNumber":201,"sourceCode":"        if adapter == \"azure\":\n            api_version = runtime_app_config.get(\n                provider.config_key(\"api_version\"), \"2024-02-15-preview\"\n            )\n\n        extra_values = {\n            field.config_suffix: (\n                runtime_app_config.get(provider.config_key(field.config_suffix), \"\")\n                or field.default_value\n            )\n            for field in provider.extra_fields\n        }\n\n        if provider.requires_api_key and not api_key:\n            raise ValueError(\n                f\"{llm_provider}: api_key is not set, please set it in the config.toml file.\"\n            )\n        if provider.requires_model_name and not model_name:\n            raise ValueError(\n                f\"{llm_provider}: model_name is not set, please set it in the config.toml file.\"\n            )\n        if provider.requires_base_url and not base_url:\n            raise ValueError(\n                f\"{llm_provider}: base_url is not set, please set it in the config.toml file.\"\n            )\n\n        for field in provider.extra_fields:\n            if field.required and not extra_values[field.config_suffix]:\n                raise ValueError(\n                    f\"{llm_provider}: {field.config_suffix} is not set, \"\n                    \"please set it in the config.toml file.\"\n                )\n\n        if adapter == \"qwen\":\n            import dashscope\n            from dashscope.api_entities.dashscope_response import GenerationResponse\n","sourceCodeStart":183,"sourceCodeEnd":219,"githubUrl":"https://github.com/harry0703/MoneyPrinterTurbo/blob/1f9f19c2021a68d04df228f33e9099a0c947f6f8/app/services/llm.py#L183-L219","documentation":"Model-name guard in _generate_response: the provider declares requires_model_name but the resolved model_name is empty. Note resolve_model_name may substitute a default when the configured value is a deprecated alias — this error only fires when resolution still yields an empty string.","triggerScenarios":"Providers with requires_model_name=true (e.g. gemini, qwen, litellm adapter) where the <provider>.model_name config entry is absent/empty AND no deprecation fallback applies.","commonSituations":"Config copied without the model_name line, provider switched in the WebUI without filling its model field, config.toml section renamed so the key is orphaned, or a genuinely empty string in TOML (model_name = \"\").","solutions":["Set <provider>.model_name in config.toml to a model the provider serves (e.g. gemini-2.0-flash for the gemini provider)","If a deprecation warning about model fallback appears in logs, the fix is to update to the current model name so resolution is explicit","Use the WebUI provider settings to pick a model, which writes the correct key","After switching providers, re-check that provider's whole required-field set (api_key/model_name/base_url)"],"exampleFix":"# config.toml before\n[gemini]\napi_key = \"AIza...\"  # model_name missing -> raises\n\n# config.toml after\n[gemini]\napi_key = \"AIza...\"\nmodel_name = \"gemini-2.0-flash\"","handlingStrategy":"validation","validationCode":"model = cfg.get(provider.config_key(\"model_name\"), \"\")\nif provider.requires_model_name and not provider.resolve_model_name(model):\n    raise ConfigError(f\"{provider.config_key('model_name')} is empty\")","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Fill model_name immediately when switching providers in the WebUI","Heed deprecation warnings in logs and update model names promptly"],"tags":["configuration","llm","model-name"],"backgroundTag":null,"analyzedSha":"1f9f19c2021a68d04df228f33e9099a0c947f6f8","analyzedAt":"2026-08-14T19:41:05.568Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}