{"record":{"id":"c5e72ef309694c13","repo":"vxcontrol/pentagi","slug":"the-specified-endpoint-could-not-be-found-c5e72e","errorCode":null,"errorMessage":"the specified endpoint could not be found","messagePattern":"the specified endpoint could not be found","errorType":"http","errorClass":"Fatal","httpStatus":404,"severity":"error","filePath":"backend/pkg/tools/searchers/tavily.go","lineNumber":156,"sourceCode":"\treturn t.parseHTTPResponse(ctx, resp)\n}\n\nfunc (t *tavily) parseHTTPResponse(ctx context.Context, resp *http.Response) (string, error) {\n\tswitch resp.StatusCode {\n\tcase http.StatusOK:\n\t\tvar respBody tavilySearchResult\n\t\tif err := json.NewDecoder(resp.Body).Decode(&respBody); err != nil {\n\t\t\treturn \"\", Fatal(fmt.Errorf(\"failed to decode response body: %v\", err))\n\t\t}\n\t\treturn t.buildTavilyResult(ctx, &respBody), nil\n\tcase http.StatusBadRequest:\n\t\treturn \"\", Fatal(fmt.Errorf(\"request is invalid\"))\n\tcase http.StatusUnauthorized:\n\t\treturn \"\", Fatal(fmt.Errorf(\"API key is wrong\"))\n\tcase http.StatusForbidden:\n\t\treturn \"\", Fatal(fmt.Errorf(\"the endpoint requested is hidden for administrators only\"))\n\tcase http.StatusNotFound:\n\t\treturn \"\", Fatal(fmt.Errorf(\"the specified endpoint could not be found\"))\n\tcase http.StatusMethodNotAllowed:\n\t\treturn \"\", Fatal(fmt.Errorf(\"there need to try to access an endpoint with an invalid method\"))\n\tcase http.StatusTooManyRequests:\n\t\treturn \"\", Retryable(fmt.Errorf(\"there are requesting too many results\"), 0)\n\tcase http.StatusInternalServerError:\n\t\treturn \"\", Retryable(fmt.Errorf(\"there had a problem with our server. try again later\"), 0)\n\tcase http.StatusBadGateway:\n\t\treturn \"\", Retryable(fmt.Errorf(\"there was a problem with the server. Please try again later\"), 0)\n\tcase http.StatusServiceUnavailable:\n\t\treturn \"\", Retryable(fmt.Errorf(\"there are temporarily offline for maintenance. please try again later\"), 0)\n\tcase http.StatusGatewayTimeout:\n\t\treturn \"\", Retryable(fmt.Errorf(\"there are temporarily offline for maintenance. please try again later\"), 0)\n\tdefault:\n\t\treturn \"\", Fatal(fmt.Errorf(\"unexpected status code: %d\", resp.StatusCode))\n\t}\n}\n\nfunc (t *tavily) buildTavilyResult(ctx context.Context, result *tavilySearchResult) string {","sourceCodeStart":138,"sourceCodeEnd":174,"githubUrl":"https://github.com/vxcontrol/pentagi/blob/ea665308baaff015b226f308438a68d929d0f29b/backend/pkg/tools/searchers/tavily.go#L138-L174","documentation":"Thrown in tavily.parseHTTPResponse when Tavily answers HTTP 404 Not Found, mapped to \"the specified endpoint could not be found\". The configured URL (https://api.tavily.com/search) did not resolve to a valid route on the server. Classified Fatal. Since tavilyURL is a compile-time constant, this usually indicates a wrong base URL override, a proxy rewriting the path, or a Tavily-side route change/deprecation.","triggerScenarios":"POST to api.tavily.com/search returns 404: an HTTP proxy or API gateway intercepts and has no /search route, a custom base URL is configured pointing to a wrong path, or Tavily renames/versions the endpoint.","commonSituations":"Corporate proxy returning its own 404 for blocked hosts; environment variable redirecting the Tavily base URL to a self-hosted/mock endpoint missing the route; Tavily API versioning change after an update; typos when someone makes the URL configurable.","solutions":["curl -v https://api.tavily.com/search from inside the container to confirm the route exists from that network vantage point.","Check any proxy env (HTTPS_PROXY) or custom base URL override — a proxy answering its own 404 is the most common cause.","Verify the current endpoint path against Tavily's API docs and update the tavilyURL constant if it changed.","If using a gateway/mock server, ensure the /search route is registered there.","As a stopgap, ensure a fallback engine is configured so web_search degrades gracefully while the route issue is fixed."],"exampleFix":"// before: wrong versioned endpoint behind override\nconst tavilyURL = \"https://api.tavily.com/v2/search\" // 404\n// after\nconst tavilyURL = \"https://api.tavily.com/search\"","handlingStrategy":"validation","validationCode":"// verify the endpoint resolves to Tavily, not a proxy error page\nresp, err := http.Get(\"https://api.tavily.com/search\")\nif err != nil || resp.StatusCode == http.StatusNotFound {\n    return fmt.Errorf(\"/search route unreachable or mis-proxied\")\n}","typeGuard":null,"tryCatchPattern":"if err != nil {\n    if strings.Contains(err.Error(), \"endpoint could not be found\") {\n        // check proxy/URL override config, then fail over to another engine\n        return fallbackSearcher.Handle(ctx, req)\n    }\n    return err\n}","preventionTips":["Keep tavilyURL pinned to the documented endpoint; lint any configurability added to it.","Allow-list api.tavily.com in egress proxies so they don't synthesize 404s.","Re-verify the route after Tavily API version announcements.","Test the exact URL from inside the container, not just from a host machine."],"tags":["http-404","routing","searchers","proxy","go"],"backgroundTag":"http-404-not-found","analyzedSha":"ea665308baaff015b226f308438a68d929d0f29b","analyzedAt":"2026-09-01T14:16:31.421Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}