{"record":{"id":"894d6b3eac0bde20","repo":"Tencent/WeKnora","slug":"http-decode-list-engines-response-w","errorCode":null,"errorMessage":"http decode list-engines response: %w","messagePattern":"http decode list-engines response: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/infrastructure/docparser/http_parser.go","lineNumber":161,"sourceCode":"\thttpReq, err := http.NewRequestWithContext(ctx, http.MethodPost, base+PathListEngines, bytes.NewReader(jsonBody))\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"http new request: %w\", err)\n\t}\n\thttpReq.Header.Set(\"Content-Type\", \"application/json\")\n\n\tresp, err := p.client.Do(httpReq)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"http list-engines failed: %w\", err)\n\t}\n\tdefer resp.Body.Close()\n\tif resp.StatusCode != http.StatusOK {\n\t\trespBytes, _ := io.ReadAll(resp.Body)\n\t\treturn nil, fmt.Errorf(\"http list-engines status %d: %s\", resp.StatusCode, string(respBytes))\n\t}\n\n\tvar out httpListEnginesResponse\n\tif err := json.NewDecoder(resp.Body).Decode(&out); err != nil {\n\t\treturn nil, fmt.Errorf(\"http decode list-engines response: %w\", err)\n\t}\n\n\tresult := make([]types.ParserEngineInfo, 0, len(out.Engines))\n\tfor _, e := range out.Engines {\n\t\tresult = append(result, types.ParserEngineInfo{\n\t\t\tName:              e.Name,\n\t\t\tDescription:       e.Description,\n\t\t\tFileTypes:         e.FileTypes,\n\t\t\tAvailable:         e.Available,\n\t\t\tUnavailableReason: e.UnavailableReason,\n\t\t})\n\t}\n\treturn result, nil\n}\n\nfunc fromHTTPReadResponse(resp *httpReadResponse) *types.ReadResult {\n\tresult := &types.ReadResult{\n\t\tMarkdownContent: resp.MarkdownContent,","sourceCodeStart":143,"sourceCodeEnd":179,"githubUrl":"https://github.com/Tencent/WeKnora/blob/988cbb03305e055d8ebb7d46d9ac6cc0803cd074/internal/infrastructure/docparser/http_parser.go#L143-L179","documentation":"Decoding the docreader list-engines JSON response into httpListEnginesResponse failed in ListEngines — the server returned 200 with a body that is not the expected JSON shape (proxy HTML, truncated body, version mismatch).","triggerScenarios":"Thrown at internal/infrastructure/docparser/http_parser.go:161 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Log a body snippet to see what was actually returned","Check for proxies/interceptors altering responses","Verify client and docreader API versions match"],"exampleFix":null,"handlingStrategy":"try-catch","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"}