{"record":{"id":"9b906e12e03b1552","repo":"vxcontrol/pentagi","slug":"failed-to-get-task-title-w","errorCode":null,"errorMessage":"failed to get task title: %w","messagePattern":"failed to get task title: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"backend/pkg/controller/task.go","lineNumber":62,"sourceCode":"\tupdater   FlowUpdater\n\tcompleted bool\n\twaiting   bool\n}\n\nfunc NewTaskWorker(\n\tctx context.Context,\n\tflowCtx *FlowContext,\n\tinput string,\n\tupdater FlowUpdater,\n) (TaskWorker, error) {\n\tctx, span := obs.Observer.NewSpan(ctx, obs.SpanKindInternal, \"controller.NewTaskWorker\")\n\tdefer span.End()\n\n\tctx = tools.PutAgentContext(ctx, database.MsgchainTypePrimaryAgent)\n\n\ttitle, err := flowCtx.Provider.GetTaskTitle(ctx, input)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to get task title: %w\", err)\n\t}\n\n\ttask, err := flowCtx.DB.CreateTask(ctx, database.CreateTaskParams{\n\t\tStatus: database.TaskStatusCreated,\n\t\tTitle:  title,\n\t\tInput:  input,\n\t\tFlowID: flowCtx.FlowID,\n\t})\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to create task in DB: %w\", err)\n\t}\n\n\tflowCtx.Publisher.TaskCreated(ctx, task, []database.Subtask{})\n\n\ttaskCtx := &TaskContext{\n\t\tFlowContext: *flowCtx,\n\t\tTaskID:      task.ID,\n\t\tTaskTitle:   title,","sourceCodeStart":44,"sourceCodeEnd":80,"githubUrl":"https://github.com/vxcontrol/pentagi/blob/ea665308baaff015b226f308438a68d929d0f29b/backend/pkg/controller/task.go#L44-L80","documentation":"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.","triggerScenarios":"Provider unreachable, invalid/expired API key, quota exhausted, model returning invalid response, or ctx cancelled during the title generation call.","commonSituations":"No LLM provider configured for the flow; wrong API key after rotating credentials; provider outage; input too long for the model's context window.","solutions":["Check the wrapped provider error in logs","Validate provider configuration (API key, model, base URL) before creating flows","Retry task creation; nothing was persisted","Fall back to a default/truncated title if title generation is non-critical"],"exampleFix":"// before\ntitle, err := flowCtx.Provider.GetTaskTitle(ctx, input)\nif err != nil {\n    return nil, fmt.Errorf(\"failed to get task title: %w\", err)\n}\n// after\ntitle, err := flowCtx.Provider.GetTaskTitle(ctx, input)\nif err != nil {\n    log.Warn(\"title generation failed, using fallback\", \"err\", err)\n    title = truncate(input, 120)\n}","handlingStrategy":"try-catch","validationCode":"if input == \"\" { return fmt.Errorf(\"empty task input\") }\nif flowCtx.Provider == nil { return fmt.Errorf(\"no provider configured for flow\") }","typeGuard":null,"tryCatchPattern":"title, err := flowCtx.Provider.GetTaskTitle(ctx, input)\nif err != nil {\n    if isRateLimit(err) { return nil, retryAfterBackoff(err) }\n    return nil, fmt.Errorf(\"failed to get task title: %w\", err)\n}","preventionTips":["Validate provider config (key, model) before exposing task creation","Keep input within the model's context window","Pre-flight the provider with a cheap test call at startup"],"tags":["llm","provider","task-creation"],"backgroundTag":"llm-provider-call-failed","analyzedSha":"ea665308baaff015b226f308438a68d929d0f29b","analyzedAt":"2026-09-01T14:16:31.421Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}