vxcontrol/pentagi · error
failed to get active task result: %w
Error message
failed to get active task result: %w
What it means
This error is returned by flowStatusTool.buildRunningInfo (backend/pkg/tools/flow_manager.go:305) while assembling the 'Active Task' section of the flow_status tool output for an agent. When the parent task has a non-empty Result field, the code calls getResultText, which invokes the configured LLM summarizer (t.summarizer) if the result text exceeds 2*resultLimit. If the summarizer fails (network error, provider auth failure, rate limit, context cancellation), the error is wrapped as 'failed to get active task result: %w'. It is a pass-through wrapper: the real cause is always in the wrapped summarizer error.
Source
Thrown at backend/pkg/tools/flow_manager.go:305
}
}
sb := &strings.Builder{}
if activeTask != nil {
fmt.Fprintf(sb, "=== Active Task ===\n")
fmt.Fprintf(sb, "Task ID: %d | Status: %s | Title: %s\n", activeTask.ID, activeTask.Status, activeTask.Title)
if activeTask.Input != "" {
input, err := t.getInputText(ctx, activeTask.Input)
if err != nil {
return "", fmt.Errorf("failed to get active task input: %w", err)
}
fmt.Fprintf(sb, "Input:\n%s\n", input)
}
if activeTask.Result != "" {
result, err := t.getResultText(ctx, activeTask.Result)
if err != nil {
return "", fmt.Errorf("failed to get active task result: %w", err)
}
fmt.Fprintf(sb, "Result so far:\n%s\n", result)
}
}
fmt.Fprintf(sb, "\n=== Active Subtask ===\n")
fmt.Fprintf(sb, "Subtask ID: %d | Status: %s | Title: %s\n", st.ID, st.Status, st.Title)
description, err := t.getDescriptionText(ctx, st.Description)
if err != nil {
return "", fmt.Errorf("failed to get subtask description: %w", err)
}
fmt.Fprintf(sb, "Description:\n%s\n", description)
if st.Result != "" {
result, err := t.getResultText(ctx, st.Result)
if err != nil {
return "", fmt.Errorf("failed to get subtask result: %w", err)
}
fmt.Fprintf(sb, "Result so far:\n%s\n", result)View on GitHub (pinned to ea665308ba)
Solutions
- Inspect the wrapped cause (%w) in the log to identify the summarizer failure: provider error, auth, quota, or context cancellation.
- Verify the LLM provider credentials and endpoint used by the summarizer (env vars / Settings UI) and re-test the provider.
- Retry the flow_status call — transient provider rate limits and network blips usually resolve on retry.
- Reduce result size (shorter task results under 2*resultLimit bypass summarization entirely) or run with the summarizer disabled (t.summarizer == nil).
- Check that the caller's context is not being cancelled prematurely (e.g. HTTP request timeout shorter than LLM latency).
Example fix
// before: handler request ctx with short HTTP timeout kills long LLM summarization callFlowStatus(ctx) // ctx from request, 5s timeout // after: use a detached context with generous timeout for summarization sumCtx, cancel := context.WithTimeout(context.WithoutCancel(ctx), 120*time.Second) defer cancel() callFlowStatus(sumCtx)
Defensive patterns
Strategy: try-catch
Validate before calling
// before calling the tool, check the summarizer provider is configured and reachable
if summarizer != nil && activeTask.Result != "" && len(activeTask.Result) > 2*resultLimit {
if err := providerHealthCheck(ctx); err != nil {
return fmt.Errorf("summarizer provider unavailable: %w", err)
}
} Type guard
func needsSummarization(s string, limit int, hasSummarizer bool) bool {
return s != "" && hasSummarizer && len(s) > 2*limit
} Try / catch
info, err := flowStatusTool.Handle(ctx, "flow_status", args)
if err != nil {
var summarizeErr *SummarizerError
if errors.As(err, &summarizeErr) {
// transient LLM provider failure — retry with backoff
info, err = retryWithBackoff(ctx, 3, func() (string, error) {
return flowStatusTool.Handle(ctx, "flow_status", args)
})
}
if err != nil {
return fmt.Errorf("flow status unavailable: %w", err)
}
} Prevention
- Monitor LLM provider health/latency and alert on auth or quota failures before agents need status summarization.
- Keep task results under 2*resultLimit so summarization is bypassed.
- Use a context whose timeout comfortably exceeds LLM latency (e.g. context.WithoutCancel + 120s).
- Configure a fallback summarizer provider for outage resilience.
- Rotate API keys proactively and validate them at startup.
When it happens
Trigger: Calling the flow_status tool while a subtask is running/waiting, when its parent task has a non-empty Result string longer than 2*resultLimit characters AND t.summarizer != nil, and the summarizer call fails — LLM provider timeout, invalid/unauthorized API key, quota exhaustion, malformed provider response, or the request context being cancelled mid-summarization.
Common situations: Expired or missing LLM provider API key in the environment; provider outage or rate limiting during a long-running flow; agent/status polling cancelled (ctx done) while summarization is in flight; misconfigured summarizer model name after a provider config change; very large task results (no summarizer configured with short limits is fine, but big results + flaky provider trigger this).
Related errors
- failed to get subtask context: %w
- failed to set flow %d status: %w
- failed to renew flow %d status: %w
- failed to get flow %d status: %w
- flow %d is in unknown status: %s
AI-assisted analysis of vxcontrol/pentagi@ea665308ba (2026-09-01).
Data as JSON: /api/errors/38ad6f3ab7aa9275.
Report an issue: GitHub.