vxcontrol/pentagi · error

failed to get subtask result: %w

Error message

failed to get subtask result: %w

What it means

Returned by flowStatusTool.buildSubtasksList when rendering a subtask's Result in verbose mode fails. The Result field is passed to t.getResultText, which either truncates it or, when the result exceeds 2*resultLimit and a summarizer is configured, sends the (truncated) text to the LLM summarizer. The error wraps whatever the summarizer returned; it does not indicate a DB problem.

Source

Thrown at backend/pkg/tools/flow_manager.go:248

		fmt.Fprintf(sb, "Subtasks for task %d:\n\n", *taskID)
	} else {
		fmt.Fprintf(sb, "All subtasks for flow %d:\n\n", t.flowID)
	}
	for _, st := range subtasks {
		fmt.Fprintf(sb, "Subtask ID: %d | Task ID: %d | Status: %s | Title: %s\n",
			st.ID, st.TaskID, st.Status, st.Title)
		if verbose {
			if st.Description != "" {
				description, err := t.getDescriptionText(ctx, st.Description)
				if err != nil {
					return "", fmt.Errorf("failed to get subtask description: %w", err)
				}
				fmt.Fprintf(sb, "  Description: %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: %s\n", result)
			}
		}
	}

	subtasksList := sb.String()
	if t.summarizer != nil && len(subtasksList) > subtasksListLimit {
		subtasksList, err = t.summarizer(ctx, truncateText(subtasksList, summarizationLimit))
		if err != nil {
			return "", fmt.Errorf("failed to summarize subtasks list: %w", err)
		}
	}

	return subtasksList, nil
}

func (t *flowStatusTool) buildRunningInfo(ctx context.Context, verbose bool) (string, error) {

View on GitHub (pinned to ea665308ba)

Solutions

  1. Check the wrapped cause (%w) to see if it is an LLM provider auth/quota error and fix the provider credentials or billing.
  2. Verify the summarizer provider endpoint is reachable and increase its timeout.
  3. Retry the tool call; summarizer failures are often transient (rate limits).
  4. As a workaround, run the status tool with verbose=false so Result fields are not processed, or shrink subtask results so they fall under 2*resultLimit and skip summarization.

Example fix

// before
callStatusTool(ctx, FlowStatusModeAll, true) // verbose=true forces result summarization
// after
if err := callStatusTool(ctx, FlowStatusModeAll, true); err != nil {
    log.Warn("verbose status failed, falling back", "err", err)
    out, err = callStatusTool(ctx, FlowStatusModeAll, false) // skip result summarization
}
Defensive patterns

Strategy: try-catch

Validate before calling

// Go: preflight the summarizer before invoking the status tool
func summarizerHealthy(ctx context.Context, s func(context.Context, string) (string, error)) error {
    ctx, cancel := context.WithTimeout(ctx, 10*time.Second)
    defer cancel()
    _, err := s(ctx, "ping")
    return err
}

Type guard

// Go: only take the summarization path when input actually needs it
func needsSummarization(s string, limit int) bool {
    return len(s) > 2*limit
}
// treat a nil or failing summarizer as "use truncation" instead of failing

Try / catch

out, err := callFlowStatusTool(ctx, mode, true)
if err != nil {
    var summarizerErr *SomeLLMProviderError
    if errors.As(err, &summarizerErr) || strings.Contains(err.Error(), "summarize") {
        log.Warn("summarization failed, retrying non-verbose", "err", err)
        out, err = callFlowStatusTool(ctx, mode, false)
    }
    if err != nil {
        return fmt.Errorf("flow status unavailable: %w", err)
    }
}

Prevention

When it happens

Trigger: An agent calls the flow status tool with verbose=true while at least one subtask has a non-empty Result longer than 2*resultLimit characters, and the configured t.summarizer callback returns an error (LLM provider unavailable, rate-limited, auth failure, context deadline exceeded, or malformed provider response).

Common situations: LLM API key expired or quota exhausted so summarization calls fail; summarizer LLM endpoint unreachable or timing out; very large subtask results (long tool outputs) pushing every result into the summarization path; ctx cancelled by an upstream timeout while the summarizer call is in flight.

Related errors


AI-assisted analysis of vxcontrol/pentagi@ea665308ba (2026-09-01). Data as JSON: /api/errors/45a466ca58e6a746. Report an issue: GitHub.