{"record":{"id":"ec5a0fb5698f3063","repo":"microsoft/semantic-kernel","slug":"no-summary-available","errorCode":null,"errorMessage":"No summary available","messagePattern":"No summary available","errorType":"exception","errorClass":"InvalidDataException","httpStatus":null,"severity":"error","filePath":"dotnet/samples/GettingStartedWithProcesses/Step04/KernelExtensions.cs","lineNumber":34,"sourceCode":"    /// Return chat history from a singleton <see cref=\"IChatHistoryProvider\"/>.\n    /// </summary>\n    public static IChatHistoryProvider GetHistory(this Kernel kernel) =>\n        kernel.Services.GetRequiredService<IChatHistoryProvider>();\n\n    /// <summary>\n    /// Access an agent as a keyed service.\n    /// </summary>\n    public static TAgent GetAgent<TAgent>(this Kernel kernel, string key) where TAgent : Agent =>\n        kernel.Services.GetRequiredKeyedService<TAgent>(key);\n\n    /// <summary>\n    /// Summarize chat history using reducer accessed as a keyed service.\n    /// </summary>\n    public static async Task<string> SummarizeHistoryAsync(this Kernel kernel, string key, IReadOnlyList<ChatMessageContent> history)\n    {\n        ChatHistorySummarizationReducer reducer = kernel.Services.GetRequiredKeyedService<ChatHistorySummarizationReducer>(key);\n        IEnumerable<ChatMessageContent>? reducedResponse = await reducer.ReduceAsync(history);\n        ChatMessageContent summary = reducedResponse?.First() ?? throw new InvalidDataException(\"No summary available\");\n        return summary.ToString();\n    }\n}\n","sourceCodeStart":16,"sourceCodeEnd":38,"githubUrl":"https://github.com/microsoft/semantic-kernel/blob/c028a0c7dc4f0814cdcbaba9d998f187a41197bf/dotnet/samples/GettingStartedWithProcesses/Step04/KernelExtensions.cs#L16-L38","documentation":"Thrown by SummarizeHistoryAsync when the keyed ChatHistorySummarizationReducer returns no reduced messages (null or empty enumeration). The reducer depends on a summarization chat model; if that model is not configured or yields nothing, reduction produces no summary and this guard fires.","triggerScenarios":"Calling kernel.SummarizeHistoryAsync(key, history) where the keyed ChatHistorySummarizationReducer is registered but ReduceAsync returns null or an empty set; e.g. summarization service not configured, history too short to reduce, or model returned empty.","commonSituations":"Forgetting to register the summarization reducer as a keyed service with the matching key; underlying summarization model/deployment misconfigured; passing a history that the reducer cannot summarize.","solutions":["Register ChatHistorySummarizationReducer as a keyed service using the same key passed to GetAgent/SummarizeHistoryAsync.","Ensure the summarization IChatCompletionService and its model/deployment are configured.","Check that the supplied history meets the reducer's threshold (enough messages to trigger reduction).","Handle the empty result gracefully instead of throwing when reduction legitimately yields nothing."],"exampleFix":"// before\nChatMessageContent summary = reducedResponse?.First() ?? throw new InvalidDataException(\"No summary available\");\n// after - tolerate empty reductions\nif (reducedResponse is null || !reducedResponse.Any())\n    return string.Join('\\n', history.Select(m => m.Content)); // fallback to raw history\nreturn reducedResponse.First().ToString();","handlingStrategy":"validation","validationCode":"var reducer = kernel.Services.GetKeyedService<ChatHistorySummarizationReducer>(key);\nif (reducer is null) throw new InvalidOperationException($\"No ChatHistorySummarizationReducer registered for key '{key}'.\");\nif (history.Count < reducer.TargetSummarizationCount) return /* skip reduction */;","typeGuard":"bool HasReducer(Kernel k, string key) => k.Services.GetKeyedService<ChatHistorySummarizationReducer>(key) is not null;","tryCatchPattern":"try { return await kernel.SummarizeHistoryAsync(key, history); }\ncatch (InvalidDataException) { return string.Join('\\n', history.Select(m => m.Content)); }","preventionTips":["Register reducers as keyed services with stable, documented keys.","Ensure the summarization model is configured before relying on reduction.","Handle empty-reduction as a normal case rather than an error."],"tags":["chat-history","reducer","dependency-injection","processes"],"backgroundTag":null,"analyzedSha":"c028a0c7dc4f0814cdcbaba9d998f187a41197bf","analyzedAt":"2026-08-13T13:48:05.040Z","schemaVersion":2},"datasetVersion":"2026-08-13T14:17:21.547Z"}