{"record":{"id":"b5b6d49a6f3d70e1","repo":"vxcontrol/pentagi","slug":"failed-to-get-searcher-handler-w","errorCode":null,"errorMessage":"failed to get searcher handler: %w","messagePattern":"failed to get searcher handler: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"backend/pkg/providers/assistant.go","lineNumber":195,"sourceCode":"\t\treturn fmt.Errorf(\"failed to get installer handler: %w\", err)\n\t}\n\n\tmemorist, err := ap.fp.GetMemoristHandler(ctx, nil, nil)\n\tif err != nil {\n\t\tlogger.WithError(err).Error(\"failed to get memorist handler\")\n\t\treturn fmt.Errorf(\"failed to get memorist handler: %w\", err)\n\t}\n\n\tpentester, err := ap.fp.GetPentesterHandler(ctx, nil, nil)\n\tif err != nil {\n\t\tlogger.WithError(err).Error(\"failed to get pentester handler\")\n\t\treturn fmt.Errorf(\"failed to get pentester handler: %w\", err)\n\t}\n\n\tsearcher, err := ap.fp.GetSubtaskSearcherHandler(ctx, nil, nil)\n\tif err != nil {\n\t\tlogger.WithError(err).Error(\"failed to get searcher handler\")\n\t\treturn fmt.Errorf(\"failed to get searcher handler: %w\", err)\n\t}\n\n\tctx, observation := obs.Observer.NewObservation(ctx)\n\texecutorAgent := observation.Agent(\n\t\tlangfuse.WithAgentName(fmt.Sprintf(\"assistant %d for flow %d: %s\", ap.id, ap.fp.ID(), ap.fp.Title())),\n\t\tlangfuse.WithAgentInput(chain),\n\t\tlangfuse.WithAgentMetadata(langfuse.Metadata{\n\t\t\t\"assistant_id\": ap.id,\n\t\t\t\"flow_id\":      ap.fp.ID(),\n\t\t\t\"msg_chain_id\": ap.msgChainID,\n\t\t\t\"provider\":     ap.fp.Type(),\n\t\t\t\"image\":        ap.fp.Image(),\n\t\t\t\"lang\":         ap.fp.Language(),\n\t\t}),\n\t)\n\tctx, _ = executorAgent.Observation(ctx)\n\n\tcfg := tools.AssistantExecutorConfig{","sourceCodeStart":177,"sourceCodeEnd":213,"githubUrl":"https://github.com/vxcontrol/pentagi/blob/ea665308baaff015b226f308438a68d929d0f29b/backend/pkg/providers/assistant.go#L177-L213","documentation":"PerformAgentChain wraps the error from fp.GetSubtaskSearcherHandler(ctx, nil, nil), which builds the subtask searcher tool handler. This is the last handler constructed before the observation/agent loop starts; failure aborts the chain setup.","triggerScenarios":"Searcher handler factory fails: no search engine configured/available, web-search tool config missing, or dependent lookups error.","commonSituations":"No search provider keys in .env (DuckDuckGo unconfigured and paid engines missing); SEARCH_* env vars renamed after an upgrade; outbound network blocked so availability checks fail.","solutions":["Set at least one search engine config in .env (e.g. TAVILY_API_KEY or GOOGLE keys) and restart the backend.","Verify outbound network/DNS from the backend container.","Check the wrapped error in logs to identify the failing searcher.","Cross-check env var names against .env.example after upgrading."],"exampleFix":"// before\nsearcher, err := ap.fp.GetSubtaskSearcherHandler(ctx, nil, nil)\nif err != nil {\n    return fmt.Errorf(\"failed to get searcher handler: %w\", err)\n}\n// after\nsearcher, err := ap.fp.GetSubtaskSearcherHandler(ctx, &taskID, &subtaskID)\nif err != nil {\n    logger.WithError(err).Error(\"searcher init failed — configure at least one search engine\")\n    return fmt.Errorf(\"failed to get searcher handler: %w\", err)\n}","handlingStrategy":"try-catch","validationCode":"engines := 0\nfor _, k := range []string{\"GOOGLE_API_KEY\", \"TAVILY_API_KEY\", \"SEARXNG_URL\", \"PERPLEXITY_API_KEY\"} {\n    if os.Getenv(k) != \"\" { engines++ }\n}\nif engines == 0 { return errors.New(\"configure at least one search engine before running flows\") }","typeGuard":null,"tryCatchPattern":"searcher, err := ap.fp.GetSubtaskSearcherHandler(ctx, nil, nil)\nif err != nil {\n    logger.WithError(err).Error(\"searcher handler init failed\")\n    return fmt.Errorf(\"failed to get searcher handler: %w\", err)\n}","preventionTips":["Set one or more search engine keys in .env","Confirm outbound HTTPS/DNS from the backend container","Re-check env var names after version upgrades","Use the installer wizard to validate search config"],"tags":["search","tools","configuration"],"backgroundTag":"tool-handler-init-failed","analyzedSha":"ea665308baaff015b226f308438a68d929d0f29b","analyzedAt":"2026-09-01T14:16:31.421Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}