{"record":{"id":"2bc43b84ed5077d0","repo":"Tencent/WeKnora","slug":"create-request-w","errorCode":null,"errorMessage":"create request: %w","messagePattern":"create request: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/datasource/connector/notion/client.go","lineNumber":76,"sourceCode":"\n// doRequest performs an authenticated, rate-limited HTTP request to the Notion API.\nfunc (c *notionClient) doRequest(ctx context.Context, method, path string, body interface{}) ([]byte, error) {\n\tif err := c.limiter.Wait(ctx); err != nil {\n\t\treturn nil, fmt.Errorf(\"rate limiter: %w\", err)\n\t}\n\n\tvar bodyReader io.Reader\n\tif body != nil {\n\t\tbodyBytes, err := json.Marshal(body)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"marshal request body: %w\", err)\n\t\t}\n\t\tbodyReader = bytes.NewReader(bodyBytes)\n\t}\n\n\treq, err := http.NewRequestWithContext(ctx, method, c.baseURL+path, bodyReader)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"create request: %w\", err)\n\t}\n\treq.Header.Set(\"Authorization\", \"Bearer \"+c.token)\n\treq.Header.Set(\"Notion-Version\", NotionAPIVersion)\n\treq.Header.Set(\"Content-Type\", \"application/json\")\n\n\tvar lastErr error\n\tfor attempt := 0; attempt <= maxRetries; attempt++ {\n\t\tif attempt > 0 {\n\t\t\tif body != nil {\n\t\t\t\tbodyBytes, _ := json.Marshal(body)\n\t\t\t\treq.Body = io.NopCloser(bytes.NewReader(bodyBytes))\n\t\t\t}\n\t\t}\n\n\t\tresp, err := c.httpClient.Do(req)\n\t\tif err != nil {\n\t\t\tlastErr = err\n\t\t\tif attempt < maxRetries {","sourceCodeStart":58,"sourceCodeEnd":94,"githubUrl":"https://github.com/Tencent/WeKnora/blob/988cbb03305e055d8ebb7d46d9ac6cc0803cd074/internal/datasource/connector/notion/client.go#L58-L94","documentation":"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.","triggerScenarios":"Thrown at internal/datasource/connector/notion/client.go:76 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","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"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"988cbb03305e055d8ebb7d46d9ac6cc0803cd074","analyzedAt":"2026-09-02T14:41:08.344Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}