Tencent/WeKnora · error
execute request: %w
Error message
execute request: %w
What it means
doRequest wraps errors from c.httpClient.Do(req) as "execute request: %w". This is the transport layer failing: DNS resolution failure, TCP connect refused/timeout, TLS handshake error, or request cancellation via context. The client retries with backoff up to maxRetries before returning the last error.
Source
Thrown at internal/datasource/connector/yuque/client.go:78
for attempt := 0; attempt <= maxRetries; attempt++ {
reqURL := c.baseURL + path
req, err := http.NewRequestWithContext(ctx, method, reqURL, nil)
if err != nil {
return fmt.Errorf("create request: %w", err)
}
req.Header.Set("X-Auth-Token", c.token)
req.Header.Set("User-Agent", userAgent)
req.Header.Set("Content-Type", "application/json; charset=utf-8")
if attempt == 0 {
logger.Infof(ctx, "[Yuque] %s %s", method, path)
} else {
logger.Infof(ctx, "[Yuque] %s %s (retry %d/%d)", method, path, attempt, maxRetries)
}
resp, err := c.httpClient.Do(req)
if err != nil {
lastErr = fmt.Errorf("execute request: %w", err)
if attempt < maxRetries {
if sErr := sleepCtx(ctx, backoff[attempt]); sErr != nil {
return sErr
}
continue
}
return lastErr
}
body, readErr := io.ReadAll(resp.Body)
resp.Body.Close()
if readErr != nil {
lastErr = fmt.Errorf("read response body: %w", readErr)
if attempt < maxRetries {
if sErr := sleepCtx(ctx, backoff[attempt]); sErr != nil {
return sErr
}
continueView on GitHub (pinned to 988cbb0330)
Solutions
- Test outbound connectivity to the Yuque API from the host: curl -v https://www.yuque.com/api/v2.
- Configure proxy environment variables (HTTPS_PROXY) if the network requires one, or fix firewall/egress rules.
- Check DNS resolution inside the container/host (nslookup www.yuque.com).
- If context canceled, extend the request timeout or investigate why the caller's context was canceled.
- Retry later if it's a transient Yuque outage — the client already retries with backoff.
Example fix
// before (no proxy support, blocked network)
client := &http.Client{Timeout: 10 * time.Second}
// after
proxy := http.ProxyFromEnvironment
transport := &http.Transport{Proxy: proxy, TLSHandshakeTimeout: 10 * time.Second}
client := &http.Client{Transport: transport, Timeout: 30 * time.Second} Defensive patterns
Strategy: retry
Validate before calling
conn, err := net.DialTimeout("tcp", "www.yuque.com:443", 5*time.Second)
if err != nil {
return fmt.Errorf("Yuque API unreachable: %v", err)
}
conn.Close() Type guard
func isTransportError(err error) bool {
var ne net.Error
return errors.As(err, &ne) || strings.Contains(err.Error(), "execute request:")
} Try / catch
err := client.GetCurrentUser(ctx)
if err != nil && strings.HasPrefix(err.Error(), "execute request:") {
if errors.Is(ctx.Err(), context.DeadlineExceeded) {
// increase timeout and retry once
}
return err
} Prevention
- Configure proxy/firewall egress before deploying the connector.
- Set generous but bounded request timeouts.
- Monitor DNS and outbound connectivity in the deployment environment.
- Rely on the built-in backoff retries instead of tight outer retry loops.
When it happens
Trigger: Network unreachable from the host running the connector; Yuque API temporarily down or blocked by firewall/proxy; DNS not resolving www.yuque.com; context canceled (client disconnect, shutdown, deadline) mid-request.
Common situations: Deploying in an environment without outbound internet or behind a corporate proxy that isn't configured (missing HTTPS_PROXY); DNS failures in containers; transient Yuque outages; request deadlines too short.
Related errors
AI-assisted analysis of Tencent/WeKnora@988cbb0330 (2026-09-02).
Data as JSON: /api/errors/9af98c801bb9cadd.
Report an issue: GitHub.