Tencent/WeKnora · error
rate limiter: %w
Error message
rate limiter: %w
What it means
In notionClient.doRequest, c.limiter.Wait(ctx) returns the context error (usually context.Canceled) when the caller cancels or the deadline expires while waiting for a rate-limiter slot. The request was never sent; the error is the cancellation reason.
Source
Thrown at internal/datasource/connector/notion/client.go:62
const maxRetries = 3
// sleepWithContext pauses for the given duration, returning early if ctx is cancelled.
func sleepWithContext(ctx context.Context, d time.Duration) error {
t := time.NewTimer(d)
defer t.Stop()
select {
case <-t.C:
return nil
case <-ctx.Done():
return ctx.Err()
}
}
// doRequest performs an authenticated, rate-limited HTTP request to the Notion API.
func (c *notionClient) doRequest(ctx context.Context, method, path string, body interface{}) ([]byte, error) {
if err := c.limiter.Wait(ctx); err != nil {
return nil, fmt.Errorf("rate limiter: %w", err)
}
var bodyReader io.Reader
if body != nil {
bodyBytes, err := json.Marshal(body)
if err != nil {
return nil, fmt.Errorf("marshal request body: %w", err)
}
bodyReader = bytes.NewReader(bodyBytes)
}
req, err := http.NewRequestWithContext(ctx, method, c.baseURL+path, bodyReader)
if err != nil {
return nil, fmt.Errorf("create request: %w", err)
}
req.Header.Set("Authorization", "Bearer "+c.token)
req.Header.Set("Notion-Version", NotionAPIVersion)
req.Header.Set("Content-Type", "application/json")View on GitHub (pinned to 988cbb0330)
Solutions
- Inspect the wrapped context error (DeadlineExceeded vs Canceled)
- Increase or remove caller deadlines if waits are legitimately long
- Check the limiter's rate budget if waits consistently time out
Defensive patterns
Strategy: try-catch
When it happens
Trigger: Thrown at internal/datasource/connector/notion/client.go:62 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/8c229c9d3a957288.
Report an issue: GitHub.