microsoft/autogen · error · Exception
Could not create chat manager; make sure that it contains a
Error message
Could not create chat manager; make sure that it contains a ctor() or ctor(GroupChatOptions), or override the CreateChatManager method
What it means
Final fallthrough in CreateChatManager: Activator.CreateInstance(typeof(TManager), options) returned null or a type not matching TManager (and nothing threw). This means TManager has neither a public parameterless ctor nor a public ctor taking exactly one GroupChatOptions — e.g. a ctor with a different signature, internal/private ctors, or an abstract class.
Source
Thrown at dotnet/src/Microsoft.AutoGen/AgentChat/GroupChat/GroupChatBase.cs:132
public virtual TManager CreateChatManager(GroupChatOptions options)
{
try
{
if (Activator.CreateInstance(typeof(TManager), options) is TManager result)
{
return result;
}
}
catch (TargetInvocationException tie)
{
throw new Exception("Could not create chat manager", tie.InnerException);
}
catch (Exception ex)
{
throw new Exception("Could not create chat manager", ex);
}
throw new Exception("Could not create chat manager; make sure that it contains a ctor() or ctor(GroupChatOptions), or override the CreateChatManager method");
}
private sealed class RuntimeLayer(GroupChatBase<TManager> groupChat) : IRunContextLayer
{
public GroupChatBase<TManager> GroupChat { get; } = groupChat;
public InProcessRuntime? Runtime { get; private set; }
public OutputSink? OutputSink { get; private set; }
public Task? InitOnceTask { get; set; }
public Task ShutdownTask { get; set; } = Task.CompletedTask;
public async ValueTask DeinitializeAsync()
{
await this.ShutdownTask;
}
private async Task CreateRuntime()
{View on GitHub (pinned to 027ecf0a37)
Solutions
- Add a public ctor() or public ctor(GroupChatOptions options) to TManager
- Or override virtual CreateChatManager(GroupChatOptions) in your group chat subclass and construct the manager yourself
- Ensure TManager is a concrete (non-abstract, non-generic-open) class with at least one of the two supported public constructors
Example fix
// before
public class MyManager : IGroupChatManager { internal MyManager(IOptions<X> o) {} }
// after
public class MyManager : IGroupChatManager { public MyManager() {} public MyManager(GroupChatOptions options) {} } Defensive patterns
Strategy: validation
Validate before calling
var ctors = typeof(TManager).GetConstructors();
bool ok = ctors.Any(c => c.GetParameters().Length == 0
|| (c.GetParameters().Length == 1 && c.GetParameters()[0].ParameterType == typeof(GroupChatOptions)));
if (!ok) throw new InvalidOperationException($"{typeof(TManager).Name} must expose public ctor() or ctor(GroupChatOptions)"); Type guard
static bool HasRequiredCtor(Type t) => t.GetConstructors().Any(c => { var p = c.GetParameters(); return p.Length == 0 || (p.Length == 1 && p[0].ParameterType == typeof(GroupChatOptions)); }); Try / catch
catch (Exception ex) when (ex.Message.Contains("ctor() or ctor(GroupChatOptions)")) { // add the ctor or override CreateChatManager; rethrow with context } Prevention
- Give every chat manager a public parameterless or GroupChatOptions-only constructor
- Or override CreateChatManager in the group chat subclass to construct it with DI
- Add a reflection-based startup check for the manager types you register
When it happens
Trigger: Defining TManager with only ctor(SomeOtherType), internal/private constructors, additional required parameters, or declaring the group chat over an abstract manager type.
Common situations: Custom chat managers written with DI-style constructors (multiple parameters) dropped into RoundRobinGroupChat<TManager>-style base classes; refactoring a manager's ctor signature and forgetting the reflection-based instantiation constraint.
Related errors
- Could not create chat manager
- unsupported message type, only support TextMessage, ImageMes
- MultiModalMessage is not supported in the semantic kernel if
- The agent did not produce a final response. Check the agent'
- The group chat has not been initialized. It must be run befo
AI-assisted analysis of microsoft/autogen@027ecf0a37 (2026-08-15).
Data as JSON: /api/errors/c10228e8db4a3ee6.
Report an issue: GitHub.