{"record":{"id":"64e452763c9f43ca","repo":"Tencent/WeKnora","slug":"http-decode-task-response-w","errorCode":null,"errorMessage":"http decode task response: %w","messagePattern":"http decode task response: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/infrastructure/docparser/weknoracloud_http_reader.go","lineNumber":169,"sourceCode":"\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)\n\t\t\tif res.Error != \"\" {\n\t\t\t\tlogger.Errorf(ctx, \"[WeKnoraCloud] task_id=%s completed with result.error: %s\", taskID, res.Error)\n\t\t\t} else {\n\t\t\t\tlogger.Debugf(ctx, \"[WeKnoraCloud] task_id=%s completed ok markdownLen=%d\", taskID, len(res.MarkdownContent))\n\t\t\t}","sourceCodeStart":151,"sourceCodeEnd":187,"githubUrl":"https://github.com/Tencent/WeKnora/blob/988cbb03305e055d8ebb7d46d9ac6cc0803cd074/internal/infrastructure/docparser/weknoracloud_http_reader.go#L151-L187","documentation":"Deserialization error while polling a WeKnoraCloud async task: the 200 response body could not be JSON-decoded into weKnoraCloudAsyncTaskResponse. The %w wraps the decoder's error, meaning the signed poll endpoint returned an unexpected or malformed payload rather than the expected task status object.","triggerScenarios":"Thrown at internal/infrastructure/docparser/weknoracloud_http_reader.go:169 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Log the raw poll response body","Check struct tags against the actual API payload for version drift","Retry the poll; a transiently truncated body can succeed next iteration"],"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"}