microsoft/semantic-kernel · error · InvalidDataException
No summary available
Error message
No summary available
What it means
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.
Source
Thrown at dotnet/samples/GettingStartedWithProcesses/Step04/KernelExtensions.cs:34
/// Return chat history from a singleton <see cref="IChatHistoryProvider"/>.
/// </summary>
public static IChatHistoryProvider GetHistory(this Kernel kernel) =>
kernel.Services.GetRequiredService<IChatHistoryProvider>();
/// <summary>
/// Access an agent as a keyed service.
/// </summary>
public static TAgent GetAgent<TAgent>(this Kernel kernel, string key) where TAgent : Agent =>
kernel.Services.GetRequiredKeyedService<TAgent>(key);
/// <summary>
/// Summarize chat history using reducer accessed as a keyed service.
/// </summary>
public static async Task<string> SummarizeHistoryAsync(this Kernel kernel, string key, IReadOnlyList<ChatMessageContent> history)
{
ChatHistorySummarizationReducer reducer = kernel.Services.GetRequiredKeyedService<ChatHistorySummarizationReducer>(key);
IEnumerable<ChatMessageContent>? reducedResponse = await reducer.ReduceAsync(history);
ChatMessageContent summary = reducedResponse?.First() ?? throw new InvalidDataException("No summary available");
return summary.ToString();
}
}
View on GitHub (pinned to c028a0c7dc)
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.
Example fix
// before
ChatMessageContent summary = reducedResponse?.First() ?? throw new InvalidDataException("No summary available");
// after - tolerate empty reductions
if (reducedResponse is null || !reducedResponse.Any())
return string.Join('\n', history.Select(m => m.Content)); // fallback to raw history
return reducedResponse.First().ToString(); Defensive patterns
Strategy: validation
Validate before calling
var reducer = kernel.Services.GetKeyedService<ChatHistorySummarizationReducer>(key);
if (reducer is null) throw new InvalidOperationException($"No ChatHistorySummarizationReducer registered for key '{key}'.");
if (history.Count < reducer.TargetSummarizationCount) return /* skip reduction */; Type guard
bool HasReducer(Kernel k, string key) => k.Services.GetKeyedService<ChatHistorySummarizationReducer>(key) is not null;
Try / catch
try { return await kernel.SummarizeHistoryAsync(key, history); }
catch (InvalidDataException) { return string.Join('\n', history.Select(m => m.Content)); } Prevention
- 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.
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- AZURE_FOUNDRY_PROJECT_ENDPOINT is not set.
- AZURE_OPENAI_ENDPOINT is not set.
- AZURE_OPENAI_ENDPOINT is not set.
- OPENAI_API_KEY is not set.
- Failed to get a response from the chat completion service.
AI-assisted analysis of microsoft/semantic-kernel@c028a0c7dc (2026-08-13).
Data as JSON: /api/errors/ec5a0fb5698f3063.
Report an issue: GitHub.