vxcontrol/pentagi · warning · Retryable

there was a problem with the server. Please try again later

Error message

there was a problem with the server. Please try again later

What it means

Thrown in tavily.parseHTTPResponse when Tavily answers HTTP 502 Bad Gateway, mapped to "there was a problem with the server. Please try again later". An intermediary in front of Tavily (their load balancer/gateway, or your own proxy) got an invalid or no response from the upstream. Classified Retryable(err, 0) — a transient infrastructure condition, not a client bug.

Source

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

			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 {
	var writer strings.Builder
	writer.WriteString("# Answer\n\n")
	writer.WriteString(result.Answer)
	writer.WriteString("\n\n# Links\n\n")

	isRawContentExists := false
	for i, result := range result.Results {
		writer.WriteString(fmt.Sprintf("## %d. %s\n\n", i+1, result.Title))

View on GitHub (pinned to ea665308ba)

Solutions

  1. Retry with backoff — the searcher already marks this Retryable; confirm orchestrator retries and fallback engines are in place.
  2. Identify who emitted the 502: compare response headers/body with curl from the container (Tavily LB vs your corporate proxy).
  3. If your proxy is the culprit, check its logs and capacity, or bypass it for api.tavily.com.
  4. Check Tavily status page for ongoing incidents and wait if applicable.
  5. Monitor 502 frequency; sustained 502s through the same path indicate a persistent proxy/firewall misconfiguration, not a transient fault.
Defensive patterns

Strategy: retry

Try / catch

var re *RetryableError
if errors.As(err, &re) && strings.Contains(err.Error(), "problem with the server") {
    time.Sleep(backoff(retryN))
    if retryN >= maxRetries {
        return fallbackSearcher.Handle(ctx, req)
    }
    return retry(retryN + 1)
}

Prevention

When it happens

Trigger: POST to api.tavily.com/search returns 502: Tavily's gateway cannot reach its backend during deploys or incidents, or an intermediate proxy (corporate/mitm) between the container and Tavily fails to forward the request and synthesizes a 502.

Common situations: Tavily rolling deployments or upstream incidents; flaky corporate proxies dropping connections under load; Docker sandbox egress through an overloaded proxy; transient DNS/TLS issues surfaced by the proxy as 502.

Related errors


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