Tencent/WeKnora · error
create request: %w
Error message
create request: %w
What it means
HTTP client error in notionClient.doRequest: http.NewRequestWithContext could not build the request for the Notion API call (malformed method/URL combination after c.baseURL+path). The %w keeps the net/http cause; it fires before the request is sent, distinct from rate-limiter ('rate limiter') and body-marshal failures handled above it.
Source
Thrown at internal/datasource/connector/notion/client.go:76
// 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")
var lastErr error
for attempt := 0; attempt <= maxRetries; attempt++ {
if attempt > 0 {
if body != nil {
bodyBytes, _ := json.Marshal(body)
req.Body = io.NopCloser(bytes.NewReader(bodyBytes))
}
}
resp, err := c.httpClient.Do(req)
if err != nil {
lastErr = err
if attempt < maxRetries {View on GitHub (pinned to 988cbb0330)
Solutions
- Verify the configured Notion base URL parses cleanly
- Check the path does not contain invalid URL characters
- Log the full URL (without tokens) that failed to parse
Defensive patterns
Strategy: try-catch
When it happens
Trigger: Thrown at internal/datasource/connector/notion/client.go:76 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/2bc43b84ed5077d0.
Report an issue: GitHub.