{"record":{"id":"b44428d394204700","repo":"microsoft/autogen","slug":"role-textmessage-role-is-not-supported","errorCode":null,"errorMessage":"Role {textMessage.Role} is not supported","messagePattern":"Role (.+?) is not supported","errorType":"exception","errorClass":"NotSupportedException","httpStatus":null,"severity":"error","filePath":"dotnet/src/AutoGen.Anthropic/Middleware/AnthropicMessageConnector.cs","lineNumber":175,"sourceCode":"        {\n            if (textMessage.Role == Role.User)\n            {\n                messages = new ChatMessage(\n                    \"user\", textMessage.Content);\n            }\n            else if (textMessage.Role == Role.Assistant)\n            {\n                messages = new ChatMessage(\n                    \"assistant\", textMessage.Content);\n            }\n            else if (textMessage.Role == Role.System)\n            {\n                messages = new ChatMessage(\n                    \"system\", textMessage.Content);\n            }\n            else\n            {\n                throw new NotSupportedException($\"Role {textMessage.Role} is not supported\");\n            }\n        }\n        else\n        {\n            // if from is not null, then the message is from user\n            messages = new ChatMessage(\n                \"user\", textMessage.Content);\n        }\n\n        return [new MessageEnvelope<ChatMessage>(messages, from: textMessage.From)];\n    }\n\n    private async Task<IEnumerable<IMessage>> ProcessMultiModalMessageAsync(MultiModalMessage multiModalMessage, IAgent agent)\n    {\n        var content = new List<ContentBase>();\n        foreach (var message in multiModalMessage.Content)\n        {\n            switch (message)","sourceCodeStart":157,"sourceCodeEnd":193,"githubUrl":"https://github.com/microsoft/autogen/blob/027ecf0a379bcc1d09956d46d12d44a3ad9cee14/dotnet/src/AutoGen.Anthropic/Middleware/AnthropicMessageConnector.cs#L157-L193","documentation":"Error \"Role {textMessage.Role} is not supported\" thrown in microsoft/autogen.","triggerScenarios":"Thrown at dotnet/src/AutoGen.Anthropic/Middleware/AnthropicMessageConnector.cs:175 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Use only user/assistant roles; convert system messages to system parameter"],"exampleFix":"Map Role.System to the system prompt and drop other unsupported roles","handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"027ecf0a379bcc1d09956d46d12d44a3ad9cee14","analyzedAt":"2026-08-15T03:38:00.719Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}