Tencent/WeKnora · error
read response: %w
Error message
read response: %w
What it means
io.ReadAll of the Notion API response body failed in doRequest after a successful HTTP exchange — usually the connection was reset or timed out mid-body transfer. Unlike connection errors, this is not retried by the surrounding loop.
Source
Thrown at internal/datasource/connector/notion/client.go:106
}
}
resp, err := c.httpClient.Do(req)
if err != nil {
lastErr = err
if attempt < maxRetries {
if sErr := sleepWithContext(ctx, time.Duration(1<<attempt)*time.Second); sErr != nil {
return nil, sErr
}
continue
}
break
}
respBody, err := io.ReadAll(resp.Body)
resp.Body.Close()
if err != nil {
return nil, fmt.Errorf("read response: %w", err)
}
switch {
case resp.StatusCode >= 200 && resp.StatusCode < 300:
return respBody, nil
case resp.StatusCode == 401 || resp.StatusCode == 403:
return nil, fmt.Errorf("%w: %s", datasource.ErrInvalidCredentials, string(respBody))
case resp.StatusCode == 404:
return nil, fmt.Errorf("%w: %s", datasource.ErrResourceNotFound, path)
case resp.StatusCode == 429:
retryAfter := resp.Header.Get("Retry-After")
wait := 1 * time.Second
if secs, err := strconv.ParseFloat(retryAfter, 64); err == nil && secs > 0 {
wait = time.Duration(secs * float64(time.Second))
}View on GitHub (pinned to 988cbb0330)
Solutions
- Retry the request; the failure is usually transient
- Check network stability/proxies between the service and Notion
- Consider retrying partial-read failures like other transport errors
Defensive patterns
Strategy: retry
When it happens
Trigger: Thrown at internal/datasource/connector/notion/client.go:106 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of Tencent/WeKnora@988cbb0330 (2026-09-02).
Data as JSON: /api/errors/df10e5b17bd1081d.
Report an issue: GitHub.