{"record":{"id":"bafdd110003085f3","repo":"Tencent/WeKnora","slug":"http-marshal-read-request-w","errorCode":null,"errorMessage":"http marshal read request: %w","messagePattern":"http marshal read request: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/infrastructure/docparser/http_parser.go","lineNumber":222,"sourceCode":"\n\tbody := httpReadRequest{\n\t\tFileName:  req.FileName,\n\t\tFileType:  req.FileType,\n\t\tURL:       req.URL,\n\t\tTitle:     req.Title,\n\t\tRequestID: req.RequestID,\n\t\tConfig: &httpReadConfig{\n\t\t\tParserEngine:          req.ParserEngine,\n\t\t\tParserEngineOverrides: req.ParserEngineOverrides,\n\t\t},\n\t}\n\tif len(req.FileContent) > 0 {\n\t\tbody.FileContent = base64.StdEncoding.EncodeToString(req.FileContent)\n\t}\n\n\tjsonBody, err := json.Marshal(body)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"http marshal read request: %w\", err)\n\t}\n\thttpReq, err := http.NewRequestWithContext(ctx, http.MethodPost, base+PathRead, 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\thttpReq.ContentLength = int64(len(jsonBody))\n\n\tresp, err := p.client.Do(httpReq)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"http read failed: %w\", err)\n\t}\n\tdefer resp.Body.Close()\n\tif resp.StatusCode != http.StatusOK {\n\t\tbodyBytes, _ := io.ReadAll(resp.Body)\n\t\treturn nil, fmt.Errorf(\"http read status %d: %s\", resp.StatusCode, string(bodyBytes))\n\t}\n\tvar out httpReadResponse","sourceCodeStart":204,"sourceCodeEnd":240,"githubUrl":"https://github.com/Tencent/WeKnora/blob/988cbb03305e055d8ebb7d46d9ac6cc0803cd074/internal/infrastructure/docparser/http_parser.go#L204-L240","documentation":"Serialization error in HTTPDocumentReader.Read: marshaling the httpReadRequest payload (file metadata, base64 content, parser config) to JSON failed. The %w wraps encoding/json's error; it fires before any request is built or sent, indicating the request struct could not be serialized (e.g., unsupported field type).","triggerScenarios":"Thrown at internal/infrastructure/docparser/http_parser.go:222 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Check ReadRequest fields for unsupported types","Ensure config overrides are serializable","Log the marshal error for the offending field"],"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"}