{"record":{"id":"4c55e9f47db20e8e","repo":"Tencent/WeKnora","slug":"http-poll-task-failed-w","errorCode":null,"errorMessage":"http poll task failed: %w","messagePattern":"http poll task failed: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/infrastructure/docparser/weknoracloud_http_reader.go","lineNumber":157,"sourceCode":"func (p *WeKnoraCloudSignedDocumentReader) pollTaskResult(ctx context.Context, taskID string) (*types.ReadResult, error) {\n\tpollCtx := ctx\n\tif _, ok := ctx.Deadline(); !ok && p.pollTimeout > 0 {\n\t\tvar cancel context.CancelFunc\n\t\tpollCtx, cancel = context.WithTimeout(ctx, p.pollTimeout)\n\t\tdefer cancel()\n\t}\n\tstatusURL := weKnoraCloudReaderBaseURL + \"/\" + taskID\n\tcurrentInterval := p.initialPollInterval\n\tfor {\n\t\thttpReq, err := p.newSignedRequest(pollCtx, http.MethodGet, statusURL, nil)\n\t\tif err != nil {\n\t\t\tlogger.Errorf(context.Background(), \"[WeKnoraCloud] poll signed request task_id=%s: %v\", taskID, err)\n\t\t\treturn nil, err\n\t\t}\n\t\tresp, err := p.client.Do(httpReq)\n\t\tif err != nil {\n\t\t\tlogger.Errorf(context.Background(), \"[WeKnoraCloud] http poll task_id=%s failed: %v\", taskID, err)\n\t\t\treturn nil, fmt.Errorf(\"http poll task failed: %w\", err)\n\t\t}\n\t\tvar taskResp weKnoraCloudAsyncTaskResponse\n\t\tfunc() {\n\t\t\tdefer resp.Body.Close()\n\t\t\tif resp.StatusCode != http.StatusOK {\n\t\t\t\tbodyBytes, _ := io.ReadAll(resp.Body)\n\t\t\t\terr = fmt.Errorf(\"http poll task status %d: %s\", resp.StatusCode, string(bodyBytes))\n\t\t\t\tlogger.Errorf(context.Background(), \"[WeKnoraCloud] poll task_id=%s status %d: %s\", taskID, resp.StatusCode, string(bodyBytes))\n\t\t\t\treturn\n\t\t\t}\n\t\t\tif decodeErr := json.NewDecoder(resp.Body).Decode(&taskResp); decodeErr != nil {\n\t\t\t\terr = fmt.Errorf(\"http decode task response: %w\", decodeErr)\n\t\t\t\tlogger.Errorf(context.Background(), \"[WeKnoraCloud] poll task_id=%s decode response: %v\", taskID, decodeErr)\n\t\t\t}\n\t\t}()\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}","sourceCodeStart":139,"sourceCodeEnd":175,"githubUrl":"https://github.com/Tencent/WeKnora/blob/988cbb03305e055d8ebb7d46d9ac6cc0803cd074/internal/infrastructure/docparser/weknoracloud_http_reader.go#L139-L175","documentation":"Fired in pollTaskResult when the signed GET of the task status URL fails at transport level (client.Do error): network interruption, DNS, TLS, or the poll context deadline expired. The polling loop aborts immediately rather than retrying this iteration.","triggerScenarios":"Thrown at internal/infrastructure/docparser/weknoracloud_http_reader.go:157 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Check connectivity to the WeKnoraCloud status endpoint","Inspect the wrapped error for timeout vs connection causes","If the poll context deadline expired, raise pollTimeout or the caller's deadline","Retry the whole poll/read operation; the task may still complete server-side"],"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"}