{"record":{"id":"3c9d618bce1a0d9a","repo":"microsoft/autogen","slug":"unsupported-config-type-llmconfig-gettype","errorCode":null,"errorMessage":"Unsupported config type {llmConfig.GetType()}","messagePattern":"Unsupported config type (.+?)","errorType":"exception","errorClass":"ArgumentException","httpStatus":null,"severity":"error","filePath":"dotnet/src/AutoGen/Agent/ConversableAgent.cs","lineNumber":104,"sourceCode":"        {\n            IAgent nextAgent = llmConfig switch\n            {\n                AzureOpenAIConfig azureConfig => new OpenAIChatAgent(\n                    chatClient: azureConfig.CreateChatClient(),\n                    name: this.Name!,\n                    systemMessage: this.systemMessage)\n                    .RegisterMessageConnector(),\n                OpenAIConfig openAIConfig => new OpenAIChatAgent(\n                    chatClient: openAIConfig.CreateChatClient(),\n                    name: this.Name!,\n                    systemMessage: this.systemMessage)\n                    .RegisterMessageConnector(),\n                LMStudioConfig lmStudioConfig => new OpenAIChatAgent(\n                    chatClient: lmStudioConfig.CreateChatClient(),\n                    name: this.Name!,\n                    systemMessage: this.systemMessage)\n                    .RegisterMessageConnector(),\n                _ => throw new ArgumentException($\"Unsupported config type {llmConfig.GetType()}\"),\n            };\n\n            if (agent == null)\n            {\n                agent = nextAgent;\n            }\n            else\n            {\n                agent = agent.RegisterMiddleware(async (messages, option, agent, cancellationToken) =>\n                {\n                    var agentResponse = await nextAgent.GenerateReplyAsync(messages, option, cancellationToken: cancellationToken);\n\n                    if (agentResponse is null)\n                    {\n                        return await agent.GenerateReplyAsync(messages, option, cancellationToken);\n                    }\n                    else\n                    {","sourceCodeStart":86,"sourceCodeEnd":122,"githubUrl":"https://github.com/microsoft/autogen/blob/027ecf0a379bcc1d09956d46d12d44a3ad9cee14/dotnet/src/AutoGen/Agent/ConversableAgent.cs#L86-L122","documentation":"Thrown by ConversableAgent when building its inner agent chain from ConversableAgentConfig.ConfigList. The switch in ConversableAgent.cs only recognizes AzureOpenAIConfig, OpenAIConfig, and LMStudioConfig; any other ILLMConfig implementation hits the default arm and throws ArgumentException naming the offending runtime type.","triggerScenarios":"Constructing a ConversableAgent whose ConfigList contains a custom ILLMConfig implementation (e.g. your own openai-like config class), or a config type added by a newer AutoGen version while running an older binary.","commonSituations":"Users create a custom class implementing ILLMConfig for a local/other provider and expect ConversableAgent to pick it up; upgrading/downgrading AutoGen packages so a config type exists but is not handled by the installed ConversableAgent; copying config-loading code from samples that use newer config types.","solutions":["Use one of the supported config types in ConfigList: AzureOpenAIConfig, OpenAIConfig, or LMStudioConfig","For openai-compatible endpoints not covered, model them with LMStudioConfig(uri, modelName) or OpenAIConfig pointed at the compatible base URL","If you truly need a custom config, bypass ConversableAgent's ConfigList and construct the agent (e.g. OpenAIChatAgent) directly, or extend ConversableAgent and override the agent construction"],"exampleFix":"// before\npublic class MyProviderConfig : ILLMConfig { ... }\nvar agent = new ConversableAgent(\"a\", config: new ConversableAgentConfig { ConfigList = [new MyProviderConfig()] });\n// after\nvar agent = new ConversableAgent(\"a\", config: new ConversableAgentConfig { ConfigList = [new LMStudioConfig(new Uri(\"http://localhost:1234/v1\"), \"model\")] });","handlingStrategy":"type-guard","validationCode":"bool IsSupportedConfig(ILLMConfig c) => c is AzureOpenAIConfig or OpenAIConfig or LMStudioConfig;\nif (config.ConfigList.Any(c => !IsSupportedConfig(c))) throw new ConfigurationException($\"Unsupported config in ConfigList\");","typeGuard":"static bool IsSupportedConfig(ILLMConfig config) => config is AzureOpenAIConfig or OpenAIConfig or LMStudioConfig;","tryCatchPattern":"catch (ArgumentException ex) when (ex.Message.StartsWith(\"Unsupported config type\")) { throw new ConfigurationException(\"Check ConfigList entries; supported: AzureOpenAIConfig, OpenAIConfig, LMStudioConfig\", ex); }","preventionTips":["Validate ConfigList entries against the supported set at startup","Keep AutoGen packages version-aligned so new config types ship with matching ConversableAgent support","For unsupported providers, construct the underlying agent type directly instead of going through ConfigList"],"tags":["autogen","conversable-agent","llm-config","validation","csharp"],"backgroundTag":null,"analyzedSha":"027ecf0a379bcc1d09956d46d12d44a3ad9cee14","analyzedAt":"2026-08-15T03:38:00.719Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}