harry0703/MoneyPrinterTurbo · error · ValueError

{llm_provider}: model_name is not set, please set it in the

Error message

{llm_provider}: model_name is not set, please set it in the config.toml file.

What it means

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.

Source

Thrown at app/services/llm.py:201

        if adapter == "azure":
            api_version = runtime_app_config.get(
                provider.config_key("api_version"), "2024-02-15-preview"
            )

        extra_values = {
            field.config_suffix: (
                runtime_app_config.get(provider.config_key(field.config_suffix), "")
                or field.default_value
            )
            for field in provider.extra_fields
        }

        if provider.requires_api_key and not api_key:
            raise ValueError(
                f"{llm_provider}: api_key is not set, please set it in the config.toml file."
            )
        if provider.requires_model_name and not model_name:
            raise ValueError(
                f"{llm_provider}: model_name is not set, please set it in the config.toml file."
            )
        if provider.requires_base_url and not base_url:
            raise ValueError(
                f"{llm_provider}: base_url is not set, please set it in the config.toml file."
            )

        for field in provider.extra_fields:
            if field.required and not extra_values[field.config_suffix]:
                raise ValueError(
                    f"{llm_provider}: {field.config_suffix} is not set, "
                    "please set it in the config.toml file."
                )

        if adapter == "qwen":
            import dashscope
            from dashscope.api_entities.dashscope_response import GenerationResponse

View on GitHub (pinned to 1f9f19c202)

Solutions

  1. Set <provider>.model_name in config.toml to a model the provider serves (e.g. gemini-2.0-flash for the gemini provider)
  2. If a deprecation warning about model fallback appears in logs, the fix is to update to the current model name so resolution is explicit
  3. Use the WebUI provider settings to pick a model, which writes the correct key
  4. After switching providers, re-check that provider's whole required-field set (api_key/model_name/base_url)

Example fix

# config.toml before
[gemini]
api_key = "AIza..."  # model_name missing -> raises

# config.toml after
[gemini]
api_key = "AIza..."
model_name = "gemini-2.0-flash"
Defensive patterns

Strategy: validation

Validate before calling

model = cfg.get(provider.config_key("model_name"), "")
if provider.requires_model_name and not provider.resolve_model_name(model):
    raise ConfigError(f"{provider.config_key('model_name')} is empty")

Prevention

When it happens

Trigger: 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.

Common situations: 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 = "").

Related errors


AI-assisted analysis of harry0703/MoneyPrinterTurbo@1f9f19c202 (2026-08-14). Data as JSON: /api/errors/1ebbfa1e47e3aa4e. Report an issue: GitHub.