{"record":{"id":"d2d17220dbfcd046","repo":"Tencent/WeKnora","slug":"http-poll-task-status-d-s","errorCode":null,"errorMessage":"http poll task status %d: %s","messagePattern":"http poll task status (.+?): (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/infrastructure/docparser/weknoracloud_http_reader.go","lineNumber":164,"sourceCode":"\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}\n\t\tswitch taskResp.Status {\n\t\tcase \"completed\":\n\t\t\tif taskResp.Result == nil {\n\t\t\t\tlogger.Infof(ctx, \"[WeKnoraCloud] task_id=%s completed with no result payload\", taskID)\n\t\t\t\treturn &types.ReadResult{}, nil\n\t\t\t}\n\t\t\tres := fromHTTPReadResponse(taskResp.Result)","sourceCodeStart":146,"sourceCodeEnd":182,"githubUrl":"https://github.com/Tencent/WeKnora/blob/988cbb03305e055d8ebb7d46d9ac6cc0803cd074/internal/infrastructure/docparser/weknoracloud_http_reader.go#L146-L182","documentation":"Fired in pollTaskResult when the task status endpoint returns a non-200 status. Body content is embedded in the message; commonly 404 (task expired or unknown task_id), 401/403 (signature/auth problem), or 5xx (service error).","triggerScenarios":"Thrown at internal/infrastructure/docparser/weknoracloud_http_reader.go:164 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Check the embedded body for the server's error detail","On 404 the task likely expired or the task_id is wrong; resubmit the read","On 401/403 verify signing credentials","On 5xx retry the poll after a delay"],"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"}