{"record":{"id":"081989c32a23071f","repo":"vxcontrol/pentagi","slug":"failed-to-get-active-task-input-w","errorCode":null,"errorMessage":"failed to get active task input: %w","messagePattern":"failed to get active task input: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"backend/pkg/tools/flow_manager.go","lineNumber":133,"sourceCode":"\t\tif st.Status == database.SubtaskStatusRunning || st.Status == database.SubtaskStatusWaiting {\n\t\t\tactiveST = &subtasks[i]\n\t\t}\n\t}\n\n\tsb := &strings.Builder{}\n\tfmt.Fprintf(sb, \"Flow ID: %d\\n\", t.flowID)\n\tfmt.Fprintf(sb, \"Flow status: %s\\n\", inferFlowStatus(tasks))\n\tfmt.Fprintf(sb, \"Tasks    — total: %d, running: %d, waiting: %d, finished: %d, failed: %d, planned: %d\\n\",\n\t\tlen(tasks), taskCounts[\"running\"], taskCounts[\"waiting\"], taskCounts[\"finished\"], taskCounts[\"failed\"], taskCounts[\"created\"])\n\tfmt.Fprintf(sb, \"Subtasks — total: %d, running: %d, waiting: %d, finished: %d, failed: %d, planned: %d\\n\",\n\t\tlen(subtasks), stCounts[\"running\"], stCounts[\"waiting\"], stCounts[\"finished\"], stCounts[\"failed\"], stCounts[\"created\"])\n\n\tif activeTask != nil {\n\t\tfmt.Fprintf(sb, \"\\nActive task:    ID=%-6d | %-8s | %s\\n\", activeTask.ID, activeTask.Status, activeTask.Title)\n\t\tif verbose && activeTask.Input != \"\" {\n\t\t\tinput, err := t.getInputText(ctx, activeTask.Input)\n\t\t\tif err != nil {\n\t\t\t\treturn \"\", fmt.Errorf(\"failed to get active task input: %w\", err)\n\t\t\t}\n\t\t\tfmt.Fprintf(sb, \"  Input: %s\\n\", input)\n\t\t}\n\t}\n\tif activeST != nil {\n\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}","sourceCodeStart":115,"sourceCodeEnd":151,"githubUrl":"https://github.com/vxcontrol/pentagi/blob/ea665308baaff015b226f308438a68d929d0f29b/backend/pkg/tools/flow_manager.go#L115-L151","documentation":"Thrown in buildSummary (backend/pkg/tools/flow_manager.go:133) when rendering the active task's Input field in verbose mode. task.Input is either a literal string or an oversized text that must pass through t.getInputText, which may invoke the LLM summarizer (t.summarizer) for inputs larger than 2*inputLimit (16 KB); the error is the summarizer failure wrapped for context.","triggerScenarios":"get_flow_status with detail='summary' and verbose=true, where the running/waiting task's Input exceeds 16 KB and t.summarizer is non-nil, and the summarizer call fails (LLM provider error, rate limit, context cancelled, provider not configured/misconfigured).","commonSituations":"LLM API key expired or quota exhausted so the summarize call 401/429s; summarizer configured with a provider whose model rejects the 128 KB truncated input; caller context deadline cancelled mid-summarization; Ollama/local provider endpoint unreachable.","solutions":["Read the wrapped cause (%w) — it is a summarizer/LLM failure; check the provider credentials, quota, and endpoint in the settings/.env.","Retry the tool call once the LLM provider is healthy, or use verbose=false which skips the input summarization path entirely.","Reduce task input size (submit_flow_input with shorter input) so len(input) <= 2*inputLimit and the summarizer is never invoked.","Fix or disable the summarizer (nil summarizer falls back to plain truncation via truncateText)."],"exampleFix":"// before (fails hard when summarizer errors)\ninput, err := t.getInputText(ctx, activeTask.Input)\nif err != nil {\n\treturn \"\", fmt.Errorf(\"failed to get active task input: %w\", err)\n}\n// after: degrade gracefully to truncated text\ninput, err := t.getInputText(ctx, activeTask.Input)\nif err != nil {\n\tinput = truncateText(activeTask.Input, inputLimit) + \" (summarization failed)\"\n}","handlingStrategy":"fallback","validationCode":"// check summarizer health before issuing a verbose call\nif len(activeTaskInput) > 2*inputLimit && summarizer != nil {\n\tif err := pingSummarizer(ctx); err != nil {\n\t\tverbose = false // skip LLM compression path\n\t}\n}","typeGuard":null,"tryCatchPattern":"// Go: treat summarizer failure as non-fatal\nout, err := tool.Handle(ctx, \"get_flow_status\", verboseArgs)\nif err != nil && strings.Contains(err.Error(), \"failed to get active task input\") {\n\tout, err = tool.Handle(ctx, \"get_flow_status\", nonVerboseArgs) // fallback\n}","preventionTips":["Keep task inputs under 16 KB so the summarizer is never invoked for them.","Verify LLM provider keys/quota for the summarizer before long runs.","Set an adequate context deadline around the tool call to cover summarization latency.","Provide a nil summarizer or robust fallback so failures degrade to truncation."],"tags":["llm","summarization","tool","flow-status"],"backgroundTag":"llm-summarization-failed","analyzedSha":"ea665308baaff015b226f308438a68d929d0f29b","analyzedAt":"2026-09-01T14:16:31.421Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}