{"record":{"id":"60bee9a1b7bc3ba8","repo":"Tencent/WeKnora","slug":"marshal-request-body-w","errorCode":null,"errorMessage":"marshal request body: %w","messagePattern":"marshal request body: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/datasource/connector/notion/client.go","lineNumber":69,"sourceCode":"\tselect {\n\tcase <-t.C:\n\t\treturn nil\n\tcase <-ctx.Done():\n\t\treturn ctx.Err()\n\t}\n}\n\n// doRequest performs an authenticated, rate-limited HTTP request to the Notion API.\nfunc (c *notionClient) doRequest(ctx context.Context, method, path string, body interface{}) ([]byte, error) {\n\tif err := c.limiter.Wait(ctx); err != nil {\n\t\treturn nil, fmt.Errorf(\"rate limiter: %w\", err)\n\t}\n\n\tvar bodyReader io.Reader\n\tif body != nil {\n\t\tbodyBytes, err := json.Marshal(body)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"marshal request body: %w\", err)\n\t\t}\n\t\tbodyReader = bytes.NewReader(bodyBytes)\n\t}\n\n\treq, err := http.NewRequestWithContext(ctx, method, c.baseURL+path, bodyReader)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"create request: %w\", err)\n\t}\n\treq.Header.Set(\"Authorization\", \"Bearer \"+c.token)\n\treq.Header.Set(\"Notion-Version\", NotionAPIVersion)\n\treq.Header.Set(\"Content-Type\", \"application/json\")\n\n\tvar lastErr error\n\tfor attempt := 0; attempt <= maxRetries; attempt++ {\n\t\tif attempt > 0 {\n\t\t\tif body != nil {\n\t\t\t\tbodyBytes, _ := json.Marshal(body)\n\t\t\t\treq.Body = io.NopCloser(bytes.NewReader(bodyBytes))","sourceCodeStart":51,"sourceCodeEnd":87,"githubUrl":"https://github.com/Tencent/WeKnora/blob/988cbb03305e055d8ebb7d46d9ac6cc0803cd074/internal/datasource/connector/notion/client.go#L51-L87","documentation":"json.Marshal of the outgoing Notion API request body failed in doRequest. Since bodies are struct/map values built in code, this indicates an unsupported type (e.g. channel, func, or cyclic data) was passed as the request body.","triggerScenarios":"Thrown at internal/datasource/connector/notion/client.go:69 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Check the body argument for unsupported value types","Ensure nested values are JSON-serializable structs/maps","Marshal the body once at construction to fail fast"],"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"}