{"record":{"id":"f06cb1db186508f0","repo":"Tencent/WeKnora","slug":"http-decode-read-submit-response-w","errorCode":null,"errorMessage":"http decode read submit response: %w","messagePattern":"http decode read submit response: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/infrastructure/docparser/weknoracloud_http_reader.go","lineNumber":111,"sourceCode":"\tif err != nil {\n\t\tlogger.Errorf(context.Background(), \"[WeKnoraCloud] signed read request: %v\", err)\n\t\treturn nil, err\n\t}\n\tresp, err := p.client.Do(httpReq)\n\tif err != nil {\n\t\tlogger.Errorf(context.Background(), \"[WeKnoraCloud] http read request failed: %v\", err)\n\t\treturn nil, fmt.Errorf(\"http read failed: %w\", err)\n\t}\n\tdefer resp.Body.Close()\n\tif resp.StatusCode != http.StatusAccepted && resp.StatusCode != http.StatusOK {\n\t\tbodyBytes, _ := io.ReadAll(resp.Body)\n\t\tlogger.Errorf(context.Background(), \"[WeKnoraCloud] http read unexpected status %d: %s\", resp.StatusCode, string(bodyBytes))\n\t\treturn nil, fmt.Errorf(\"http read status %d: %s\", resp.StatusCode, string(bodyBytes))\n\t}\n\tvar submit weKnoraCloudAsyncSubmitResponse\n\tif err := json.NewDecoder(resp.Body).Decode(&submit); err != nil {\n\t\tlogger.Errorf(context.Background(), \"[WeKnoraCloud] decode read submit response: %v\", err)\n\t\treturn nil, fmt.Errorf(\"http decode read submit response: %w\", err)\n\t}\n\tif strings.TrimSpace(submit.TaskID) == \"\" {\n\t\tlogger.Errorf(context.Background(), \"[WeKnoraCloud] submit response missing task_id (status=%q message=%q)\", submit.Status, submit.Message)\n\t\treturn nil, fmt.Errorf(\"weknoracloud docreader submit response missing task_id\")\n\t}\n\tlogger.Infof(ctx, \"[WeKnoraCloud] task submitted task_id=%s file=%q type=%q\", submit.TaskID, req.FileName, req.FileType)\n\treturn p.pollTaskResult(ctx, submit.TaskID)\n}\n\ntype weKnoraCloudAsyncSubmitResponse struct {\n\tTaskID    string `json:\"task_id\"`\n\tStatus    string `json:\"status\"`\n\tMessage   string `json:\"message\"`\n\tCreatedAt int64  `json:\"created_at\"`\n}\n\ntype weKnoraCloudAsyncTaskResponse struct {\n\tTaskID    string            `json:\"task_id\"`","sourceCodeStart":93,"sourceCodeEnd":129,"githubUrl":"https://github.com/Tencent/WeKnora/blob/988cbb03305e055d8ebb7d46d9ac6cc0803cd074/internal/infrastructure/docparser/weknoracloud_http_reader.go#L93-L129","documentation":"Fired in Read when the JSON body of the submit response from WeKnoraCloud /reader cannot be decoded into weKnoraCloudAsyncSubmitResponse. Means the server returned 2xx but a malformed or unexpected payload, or an empty/truncated body.","triggerScenarios":"Thrown at internal/infrastructure/docparser/weknoracloud_http_reader.go:111 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Log the raw response body to see what the server actually returned","Verify the WeKnoraCloud server version matches the expected API schema","Retry the submission once; a truncated response may be transient"],"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"}