vxcontrol/pentagi · error · Fatal

the specified endpoint could not be found

Error message

the specified endpoint could not be found

What it means

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.

Source

Thrown at backend/pkg/tools/searchers/tavily.go:156

	return t.parseHTTPResponse(ctx, resp)
}

func (t *tavily) parseHTTPResponse(ctx context.Context, resp *http.Response) (string, error) {
	switch resp.StatusCode {
	case http.StatusOK:
		var respBody tavilySearchResult
		if err := json.NewDecoder(resp.Body).Decode(&respBody); err != nil {
			return "", Fatal(fmt.Errorf("failed to decode response body: %v", err))
		}
		return t.buildTavilyResult(ctx, &respBody), nil
	case http.StatusBadRequest:
		return "", Fatal(fmt.Errorf("request is invalid"))
	case http.StatusUnauthorized:
		return "", Fatal(fmt.Errorf("API key is wrong"))
	case http.StatusForbidden:
		return "", Fatal(fmt.Errorf("the endpoint requested is hidden for administrators only"))
	case http.StatusNotFound:
		return "", Fatal(fmt.Errorf("the specified endpoint could not be found"))
	case http.StatusMethodNotAllowed:
		return "", Fatal(fmt.Errorf("there need to try to access an endpoint with an invalid method"))
	case http.StatusTooManyRequests:
		return "", Retryable(fmt.Errorf("there are requesting too many results"), 0)
	case http.StatusInternalServerError:
		return "", Retryable(fmt.Errorf("there had a problem with our server. try again later"), 0)
	case http.StatusBadGateway:
		return "", Retryable(fmt.Errorf("there was a problem with the server. Please try again later"), 0)
	case http.StatusServiceUnavailable:
		return "", Retryable(fmt.Errorf("there are temporarily offline for maintenance. please try again later"), 0)
	case http.StatusGatewayTimeout:
		return "", Retryable(fmt.Errorf("there are temporarily offline for maintenance. please try again later"), 0)
	default:
		return "", Fatal(fmt.Errorf("unexpected status code: %d", resp.StatusCode))
	}
}

func (t *tavily) buildTavilyResult(ctx context.Context, result *tavilySearchResult) string {

View on GitHub (pinned to ea665308ba)

Solutions

  1. curl -v https://api.tavily.com/search from inside the container to confirm the route exists from that network vantage point.
  2. Check any proxy env (HTTPS_PROXY) or custom base URL override — a proxy answering its own 404 is the most common cause.
  3. Verify the current endpoint path against Tavily's API docs and update the tavilyURL constant if it changed.
  4. If using a gateway/mock server, ensure the /search route is registered there.
  5. As a stopgap, ensure a fallback engine is configured so web_search degrades gracefully while the route issue is fixed.

Example fix

// before: wrong versioned endpoint behind override
const tavilyURL = "https://api.tavily.com/v2/search" // 404
// after
const tavilyURL = "https://api.tavily.com/search"
Defensive patterns

Strategy: validation

Validate before calling

// verify the endpoint resolves to Tavily, not a proxy error page
resp, err := http.Get("https://api.tavily.com/search")
if err != nil || resp.StatusCode == http.StatusNotFound {
    return fmt.Errorf("/search route unreachable or mis-proxied")
}

Try / catch

if err != nil {
    if strings.Contains(err.Error(), "endpoint could not be found") {
        // check proxy/URL override config, then fail over to another engine
        return fallbackSearcher.Handle(ctx, req)
    }
    return err
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


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