{"record":{"id":"df10e5b17bd1081d","repo":"Tencent/WeKnora","slug":"read-response-w","errorCode":null,"errorMessage":"read response: %w","messagePattern":"read response: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/datasource/connector/notion/client.go","lineNumber":106,"sourceCode":"\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 {\n\t\t\t\tif sErr := sleepWithContext(ctx, time.Duration(1<<attempt)*time.Second); sErr != nil {\n\t\t\t\t\treturn nil, sErr\n\t\t\t\t}\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tbreak\n\t\t}\n\n\t\trespBody, err := io.ReadAll(resp.Body)\n\t\tresp.Body.Close()\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"read response: %w\", err)\n\t\t}\n\n\t\tswitch {\n\t\tcase resp.StatusCode >= 200 && resp.StatusCode < 300:\n\t\t\treturn respBody, nil\n\n\t\tcase resp.StatusCode == 401 || resp.StatusCode == 403:\n\t\t\treturn nil, fmt.Errorf(\"%w: %s\", datasource.ErrInvalidCredentials, string(respBody))\n\n\t\tcase resp.StatusCode == 404:\n\t\t\treturn nil, fmt.Errorf(\"%w: %s\", datasource.ErrResourceNotFound, path)\n\n\t\tcase resp.StatusCode == 429:\n\t\t\tretryAfter := resp.Header.Get(\"Retry-After\")\n\t\t\twait := 1 * time.Second\n\t\t\tif secs, err := strconv.ParseFloat(retryAfter, 64); err == nil && secs > 0 {\n\t\t\t\twait = time.Duration(secs * float64(time.Second))\n\t\t\t}","sourceCodeStart":88,"sourceCodeEnd":124,"githubUrl":"https://github.com/Tencent/WeKnora/blob/988cbb03305e055d8ebb7d46d9ac6cc0803cd074/internal/datasource/connector/notion/client.go#L88-L124","documentation":"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.","triggerScenarios":"Thrown at internal/datasource/connector/notion/client.go:106 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","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"],"exampleFix":null,"handlingStrategy":"retry","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"}