{"record":{"id":"1435097c4cf0d1c8","repo":"microsoft/semantic-kernel","slug":"configuration-section-section-not-found-143509","errorCode":null,"errorMessage":"Configuration section '{section}' not found","messagePattern":"Configuration section '(.+?)' not found","errorType":"exception","errorClass":"ConfigurationNotFoundException","httpStatus":null,"severity":"error","filePath":"dotnet/samples/GettingStartedWithProcesses/Step04/Step04_AgentOrchestration.cs","lineNumber":31,"sourceCode":"using Microsoft.SemanticKernel.Connectors.OpenAI;\nusing OpenAI;\nusing SharedSteps;\nusing Step04.Plugins;\nusing Step04.Steps;\n\nnamespace Step04;\n\n/// <summary>\n/// Demonstrate creation of a <see cref=\"KernelProcess\"/> that orchestrates an <see cref=\"Agent\"/> conversation.\n/// For visual reference of the process check <see href=\"https://github.com/microsoft/semantic-kernel/tree/main/dotnet/samples/GettingStartedWithProcesses/README.md#step04_agentorchestration\" >diagram</see>.\n/// </summary>\npublic class Step04_AgentOrchestration : BaseTest\n{\n    public Step04_AgentOrchestration(ITestOutputHelper output) : base(output, redirectSystemConsoleOutput: true)\n    {\n        this.Client =\n    this.UseOpenAIConfig ?\n        OpenAIAssistantAgent.CreateOpenAIClient(new ApiKeyCredential(this.ApiKey ?? throw new ConfigurationNotFoundException(\"OpenAI:ApiKey\"))) :\n        !string.IsNullOrWhiteSpace(this.ApiKey) ?\n            OpenAIAssistantAgent.CreateAzureOpenAIClient(new ApiKeyCredential(this.ApiKey), new Uri(this.Endpoint!)) :\n            OpenAIAssistantAgent.CreateAzureOpenAIClient(new AzureCliCredential(), new Uri(this.Endpoint!));\n    }\n\n    protected OpenAIClient Client { get; init; }\n\n    // Target Open AI Services\n    protected override bool ForceOpenAI => true;\n\n    /// <summary>\n    /// Orchestrates a single agent gathering user input and then delegating to a group of agents.\n    /// The group of agents provide a response back to the single agent who continues to\n    /// interact with the user.\n    /// </summary>\n    [Fact]\n    public async Task DelegatedGroupChatAsync()\n    {","sourceCodeStart":13,"sourceCodeEnd":49,"githubUrl":"https://github.com/microsoft/semantic-kernel/blob/c028a0c7dc4f0814cdcbaba9d998f187a41197bf/dotnet/samples/GettingStartedWithProcesses/Step04/Step04_AgentOrchestration.cs#L13-L49","documentation":"Thrown by the Step04_AgentOrchestration constructor when UseOpenAIConfig is true but this.ApiKey is null. Identical pattern to Step10: the single-arg ConfigurationNotFoundException reports 'OpenAI:ApiKey' as a missing configuration section.","triggerScenarios":"Constructing Step04_AgentOrchestration with UseOpenAIConfig == true (note ForceOpenAI override is true) and ApiKey unset in configuration.","commonSituations":"Running the Step04 process sample without configured OpenAI:ApiKey user-secrets; CI missing secrets; cloned repo run naively.","solutions":["Configure 'OpenAI:ApiKey' via user-secrets or appsettings for the Step04 sample project.","Confirm ForceOpenAI/UseOpenAIConfig is the intended path; otherwise set Azure OpenAI ApiKey + Endpoint.","Ensure TestConfiguration loads the configuration provider so ApiKey is populated before construction."],"exampleFix":"// before\nOpenAIAssistantAgent.CreateOpenAIClient(new ApiKeyCredential(this.ApiKey ?? throw new ConfigurationNotFoundException(\"OpenAI:ApiKey\")))\n// after\nif (string.IsNullOrWhiteSpace(this.ApiKey))\n    throw new ConfigurationNotFoundException(\"OpenAI\", \"ApiKey\");\nOpenAIAssistantAgent.CreateOpenAIClient(new ApiKeyCredential(this.ApiKey!));","handlingStrategy":"validation","validationCode":"string apiKey = config[\"OpenAI:ApiKey\"];\nif (string.IsNullOrWhiteSpace(apiKey))\n    throw new ConfigurationNotFoundException(\"OpenAI\", \"ApiKey\");","typeGuard":null,"tryCatchPattern":"try { Client = ...CreateOpenAIClient(new ApiKeyCredential(apiKey)); }\ncatch (ConfigurationNotFoundException) { /* prompt user to set OpenAI:ApiKey */ }","preventionTips":["Configure 'OpenAI:ApiKey' user-secrets for every GettingStarted sample.","Validate required keys at startup with explicit section/key arguments.","Document per-sample required configuration in the samples README."],"tags":["configuration","openai","secrets","samples","processes"],"backgroundTag":null,"analyzedSha":"c028a0c7dc4f0814cdcbaba9d998f187a41197bf","analyzedAt":"2026-08-13T13:48:05.040Z","schemaVersion":2},"datasetVersion":"2026-08-13T14:17:21.547Z"}