vxcontrol/pentagi · error

failed to get task title: %w

Error message

failed to get task title: %w

What it means

NewTaskWorker first asks the LLM provider to generate a task title from the user's input via GetTaskTitle. This error wraps a failure of that provider call, so the task is never created in the DB. It happens synchronously during CreateTask, so it surfaces directly to the API caller.

Source

Thrown at backend/pkg/controller/task.go:62

	updater   FlowUpdater
	completed bool
	waiting   bool
}

func NewTaskWorker(
	ctx context.Context,
	flowCtx *FlowContext,
	input string,
	updater FlowUpdater,
) (TaskWorker, error) {
	ctx, span := obs.Observer.NewSpan(ctx, obs.SpanKindInternal, "controller.NewTaskWorker")
	defer span.End()

	ctx = tools.PutAgentContext(ctx, database.MsgchainTypePrimaryAgent)

	title, err := flowCtx.Provider.GetTaskTitle(ctx, input)
	if err != nil {
		return nil, fmt.Errorf("failed to get task title: %w", err)
	}

	task, err := flowCtx.DB.CreateTask(ctx, database.CreateTaskParams{
		Status: database.TaskStatusCreated,
		Title:  title,
		Input:  input,
		FlowID: flowCtx.FlowID,
	})
	if err != nil {
		return nil, fmt.Errorf("failed to create task in DB: %w", err)
	}

	flowCtx.Publisher.TaskCreated(ctx, task, []database.Subtask{})

	taskCtx := &TaskContext{
		FlowContext: *flowCtx,
		TaskID:      task.ID,
		TaskTitle:   title,

View on GitHub (pinned to ea665308ba)

Solutions

  1. Check the wrapped provider error in logs
  2. Validate provider configuration (API key, model, base URL) before creating flows
  3. Retry task creation; nothing was persisted
  4. Fall back to a default/truncated title if title generation is non-critical

Example fix

// before
title, err := flowCtx.Provider.GetTaskTitle(ctx, input)
if err != nil {
    return nil, fmt.Errorf("failed to get task title: %w", err)
}
// after
title, err := flowCtx.Provider.GetTaskTitle(ctx, input)
if err != nil {
    log.Warn("title generation failed, using fallback", "err", err)
    title = truncate(input, 120)
}
Defensive patterns

Strategy: try-catch

Validate before calling

if input == "" { return fmt.Errorf("empty task input") }
if flowCtx.Provider == nil { return fmt.Errorf("no provider configured for flow") }

Try / catch

title, err := flowCtx.Provider.GetTaskTitle(ctx, input)
if err != nil {
    if isRateLimit(err) { return nil, retryAfterBackoff(err) }
    return nil, fmt.Errorf("failed to get task title: %w", err)
}

Prevention

When it happens

Trigger: Provider unreachable, invalid/expired API key, quota exhausted, model returning invalid response, or ctx cancelled during the title generation call.

Common situations: No LLM provider configured for the flow; wrong API key after rotating credentials; provider outage; input too long for the model's context window.

Related errors


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