{"record":{"id":"843e4de36aca8af8","repo":"vxcontrol/pentagi","slug":"failed-to-summarize-summary-w","errorCode":null,"errorMessage":"failed to summarize summary: %w","messagePattern":"failed to summarize summary: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"backend/pkg/tools/flow_manager.go","lineNumber":157,"sourceCode":"\t\tfmt.Fprintf(sb, \"Active subtask: ID=%-6d | %-8s | %s\\n\", activeST.ID, activeST.Status, activeST.Title)\n\t\tif verbose && activeST.Description != \"\" {\n\t\t\tdescription, err := t.getDescriptionText(ctx, activeST.Description)\n\t\t\tif err != nil {\n\t\t\t\treturn \"\", fmt.Errorf(\"failed to get active subtask description: %w\", err)\n\t\t\t}\n\t\t\tfmt.Fprintf(sb, \"  Description: %s\\n\", description)\n\t\t}\n\t}\n\n\tif len(tasks) == 0 {\n\t\tfmt.Fprintf(sb, \"\\nNo tasks yet. Flow is waiting for first input.\\n\")\n\t}\n\n\tsummary := sb.String()\n\tif t.summarizer != nil && len(summary) > summaryLimit {\n\t\tsummary, err = t.summarizer(ctx, truncateText(summary, summarizationLimit))\n\t\tif err != nil {\n\t\t\treturn \"\", fmt.Errorf(\"failed to summarize summary: %w\", err)\n\t\t}\n\t}\n\n\treturn summary, nil\n}\n\nfunc (t *flowStatusTool) buildTasksList(ctx context.Context, verbose bool) (string, error) {\n\ttasks, err := t.db.GetFlowTasks(ctx, t.flowID)\n\tif err != nil {\n\t\treturn \"\", fmt.Errorf(\"failed to get flow tasks: %w\", err)\n\t}\n\n\tif len(tasks) == 0 {\n\t\treturn \"No tasks found for this flow.\", nil\n\t}\n\n\tsb := &strings.Builder{}\n\tfmt.Fprintf(sb, \"Tasks for flow %d:\\n\\n\", t.flowID)","sourceCodeStart":139,"sourceCodeEnd":175,"githubUrl":"https://github.com/vxcontrol/pentagi/blob/ea665308baaff015b226f308438a68d929d0f29b/backend/pkg/tools/flow_manager.go#L139-L175","documentation":"Thrown in buildSummary (backend/pkg/tools/flow_manager.go:157) after the whole summary string exceeds summaryLimit (32 KB) and t.summarizer is configured: the tool asks the LLM to compress the truncated summary (max 128 KB) and wraps the summarizer's error. The flow data was collected successfully; only the final LLM compression step failed.","triggerScenarios":"get_flow_status with detail='summary' on a flow with many tasks/subtasks plus verbose inputs/descriptions pushing the summary past 32 KB, combined with a summarizer failure — LLM provider error, timeout, rate limit, cancelled context.","commonSituations":"Large, long-running flows generating huge summaries; LLM quota exhausted mid-run; summarizer provider misconfigured in Settings; local summarizer model (Ollama) offline; caller context deadline hit during the slow summarization call.","solutions":["Check the wrapped summarizer error and LLM provider status/credentials; retry once the provider recovers.","Request the summary non-verbously or use detail='tasks'/'planned' to get a smaller output under the 32 KB limit.","Reduce flow size (finish/clean subtasks) or lower stored input/result sizes so the summary stays under 32 KB.","Verify summarizer configuration (provider, model, timeout) — or disable the summarizer, which returns the truncated raw summary instead."],"exampleFix":"// before\nsummary, err = t.summarizer(ctx, truncateText(summary, summarizationLimit))\nif err != nil {\n\treturn \"\", fmt.Errorf(\"failed to summarize summary: %w\", err)\n}\n// after: fall back to the truncated raw summary\nrendered, serr := t.summarizer(ctx, truncateText(summary, summarizationLimit))\nif serr != nil {\n\tlog.Warn(\"summary summarization failed, returning truncated summary\", \"err\", serr)\n\treturn truncateText(summary, summaryLimit), nil\n}\nsummary = rendered","handlingStrategy":"fallback","validationCode":"// pre-check: skip summarization if the caller cannot afford it\nif summarizerQuotaRemaining(ctx) < 1 || len(flowTasks) > largeFlowThreshold {\n\targs = smallerDetailArgs // use detail='tasks' or non-verbose summary\n}","typeGuard":null,"tryCatchPattern":"// Go: accept the truncated raw summary as fallback\nout, err := tool.Handle(ctx, \"get_flow_status\", summaryArgs)\nif err != nil && strings.Contains(err.Error(), \"failed to summarize summary\") {\n\tout = getTruncatedSummaryDirectly(ctx, flowID) // or retry non-verbose\n}","preventionTips":["Keep flows from accumulating huge verbose payloads; archive finished flows.","Configure a summarizer model with a large context window (input is up to 128 KB).","Track LLM quota/latency for the summarizer provider and alert before exhaustion.","On failure, degrade to non-verbose detail levels instead of failing the agent step."],"tags":["llm","summarization","tool","flow-status","large-payload"],"backgroundTag":"llm-summarization-failed","analyzedSha":"ea665308baaff015b226f308438a68d929d0f29b","analyzedAt":"2026-09-01T14:16:31.421Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}