{"record":{"id":"a15d0c39c0eb4770","repo":"harry0703/MoneyPrinterTurbo","slug":"llm-provider-field-config-suffix-is-not-set","errorCode":null,"errorMessage":"{llm_provider}: {field.config_suffix} is not set, please set it in the config.toml file.","messagePattern":"(.+?): (.+?) 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":211,"sourceCode":"            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\n            dashscope.api_key = api_key\n            response = dashscope.Generation.call(\n                model=model_name, messages=[{\"role\": \"user\", \"content\": prompt}]\n            )\n            if response:\n                if isinstance(response, GenerationResponse):\n                    status_code = response.status_code\n                    if status_code != 200:\n                        raise Exception(\n                            f'[{llm_provider}] returned an error response: \"{response}\"'","sourceCodeStart":193,"sourceCodeEnd":229,"githubUrl":"https://github.com/harry0703/MoneyPrinterTurbo/blob/1f9f19c2021a68d04df228f33e9099a0c947f6f8/app/services/llm.py#L193-L229","documentation":"Raised by _generate_response() in app/services/llm.py when a provider declares an extra required field (provider.extra_fields with required=True) but its resolved value is empty. The value comes from config.app[provider.config_key(field.config_suffix)] or the field's default_value, so it fires before any network call. It is a configuration validation error, not an API error.","triggerScenarios":"Calling _generate_response() with a provider whose adapter requires extra fields (e.g. azure's api_version-style extras, or cloudflare_ai_gateway's account_id/gateway_id) while the matching config.toml key (e.g. {provider}.account_id) is missing, empty string, or has no default_value in the provider registry.","commonSituations":"Switching llm_provider to cloudflare_ai_gateway or azure in config.toml without adding the provider-specific keys; renaming the config section so the key no longer resolves; using an older config.toml after a provider gained a new required field; empty string from the WebUI config save overwriting a previously set value.","solutions":["Find the missing key: the message names the provider and field.config_suffix (e.g. 'cloudflare_ai_gateway: account_id'); add {provider}.{suffix} to config.toml under [app]","If the value is provider-specific (account_id, gateway_id, api_version), copy it from the provider console/dashboard and set it in config.toml","Restart/reload the app after editing config.toml, since runtime_app_config may be a snapshot taken at task submission","If the field should not be mandatory, verify the provider definition in app/models/llm_provider.py sets required=False or provides default_value"],"exampleFix":"# before (config.toml)\n[app]\nllm_provider = \"cloudflare_ai_gateway\"\n# account_id / gateway_id missing -> ValueError at llm.py:211\n\n# after\n[app]\nllm_provider = \"cloudflare_ai_gateway\"\ncloudflare_ai_gateway.account_id = \"abc123\"\ncloudflare_ai_gateway.gateway_id = \"gw-456\"","handlingStrategy":"validation","validationCode":"# before calling generation, verify provider extra fields\nfrom app.config import config\nfrom app.models.llm_provider import get_llm_provider\n\nprovider = get_llm_provider(cfg.get('llm_provider', '').lower())\nmissing = [\n    f.config_suffix for f in provider.extra_fields\n    if f.required and not (config.app.get(provider.config_key(f.config_suffix), '') or f.default_value)\n]\nassert not missing, f\"missing required config: {missing}\"","typeGuard":null,"tryCatchPattern":"catch ValueError and surface it to the user as a config-fix action, distinguishing it (by the 'is not set, please set it in the config.toml file' suffix) from transient API errors that deserve retry","preventionTips":["Run a config-completeness check for the selected provider at startup or before task submission","Keep a template config.toml.example listing every provider's required extra fields","Use the WebUI connection test (test_connection) to validate config before starting a video job"],"tags":["configuration","llm","validation","config-toml"],"backgroundTag":null,"analyzedSha":"1f9f19c2021a68d04df228f33e9099a0c947f6f8","analyzedAt":"2026-08-14T19:41:05.568Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}