{"record":{"id":"d7b00b8ccb8134bc","repo":"Tencent/WeKnora","slug":"http-new-request-w","errorCode":null,"errorMessage":"http new request: %w","messagePattern":"http new request: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/infrastructure/docparser/http_parser.go","lineNumber":145,"sourceCode":"\nfunc (p *HTTPDocumentReader) ListEngines(ctx context.Context, overrides map[string]string) ([]types.ParserEngineInfo, error) {\n\tbase := p.base()\n\tif base == \"\" {\n\t\treturn nil, errNotConnected\n\t}\n\tif err := secutils.ValidateURLForSSRF(base); err != nil {\n\t\treturn nil, fmt.Errorf(\"docreader address failed SSRF validation: %w\", err)\n\t}\n\n\tbody := httpListEnginesRequest{ConfigOverrides: overrides}\n\tjsonBody, err := json.Marshal(body)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"http marshal list-engines request: %w\", err)\n\t}\n\n\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","sourceCodeStart":127,"sourceCodeEnd":163,"githubUrl":"https://github.com/Tencent/WeKnora/blob/988cbb03305e055d8ebb7d46d9ac6cc0803cd074/internal/infrastructure/docparser/http_parser.go#L127-L163","documentation":"HTTP client error in HTTPDocumentReader.ListEngines: building the POST request to the docreader list-engines endpoint (base+PathListEngines) failed at http.NewRequestWithContext. The %w carries the net/http cause; it fires pre-send, after SSRF validation and body marshaling have already succeeded.","triggerScenarios":"Thrown at internal/infrastructure/docparser/http_parser.go:145 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Verify the configured docreader HTTP base URL parses","Check the path constants form a valid URL when joined","Log the composed URL to diagnose"],"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"}