{"record":{"id":"274c1b3724d53f3f","repo":"microsoft/semantic-kernel","slug":"a2aclient-apikey-must-be-provided","errorCode":null,"errorMessage":"A2AClient:ApiKey must be provided","messagePattern":"A2AClient:ApiKey must be provided","errorType":"exception","errorClass":"ArgumentException","httpStatus":null,"severity":"error","filePath":"dotnet/samples/Demos/A2AClientServer/A2AClient/Program.cs","lineNumber":46,"sourceCode":"    }\n\n    #region private\n    private static async System.Threading.Tasks.Task RunCliAsync()\n    {\n        // Set up the logging\n        using var loggerFactory = LoggerFactory.Create(builder =>\n        {\n            builder.AddConsole();\n            builder.SetMinimumLevel(LogLevel.Information);\n        });\n        var logger = loggerFactory.CreateLogger(\"A2AClient\");\n\n        // Retrieve configuration settings\n        IConfigurationRoot configRoot = new ConfigurationBuilder()\n            .AddEnvironmentVariables()\n            .AddUserSecrets(Assembly.GetExecutingAssembly())\n            .Build();\n        var apiKey = configRoot[\"A2AClient:ApiKey\"] ?? throw new ArgumentException(\"A2AClient:ApiKey must be provided\");\n        var modelId = configRoot[\"A2AClient:ModelId\"] ?? \"gpt-4.1\";\n        var agentUrls = configRoot[\"A2AClient:AgentUrls\"] ?? \"http://localhost:5000/;http://localhost:5001/;http://localhost:5002/\";\n\n        // Create the Host agent\n        var hostAgent = new HostClientAgent(logger);\n        await hostAgent.InitializeAgentAsync(modelId, apiKey, agentUrls!.Split(\";\"));\n        AgentThread thread = new ChatHistoryAgentThread();\n        try\n        {\n            while (true)\n            {\n                // Get user message\n                Console.Write(\"\\nUser (:q or quit to exit): \");\n                string? message = Console.ReadLine();\n                if (string.IsNullOrWhiteSpace(message))\n                {\n                    Console.WriteLine(\"Request cannot be empty.\");\n                    continue;","sourceCodeStart":28,"sourceCodeEnd":64,"githubUrl":"https://github.com/microsoft/semantic-kernel/blob/c028a0c7dc4f0814cdcbaba9d998f187a41197bf/dotnet/samples/Demos/A2AClientServer/A2AClient/Program.cs#L28-L64","documentation":"Error \"A2AClient:ApiKey must be provided\" thrown in microsoft/semantic-kernel.","triggerScenarios":"Thrown at dotnet/samples/Demos/A2AClientServer/A2AClient/Program.cs:46 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Set the A2AClient:ApiKey value in appsettings.json or user secrets before running the client.","Verify the configuration section name is exactly 'A2AClient' and the key is 'ApiKey'."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"c028a0c7dc4f0814cdcbaba9d998f187a41197bf","analyzedAt":"2026-08-13T13:48:05.040Z","schemaVersion":2},"datasetVersion":"2026-08-13T14:17:21.547Z"}