{"record":{"id":"0595033bfe332994","repo":"Tencent/WeKnora","slug":"render-article-html-w","errorCode":null,"errorMessage":"render article html: %w","messagePattern":"render article html: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/datasource/connector/rss/client.go","lineNumber":120,"sourceCode":"// caller can fall back to feed-provided content.\nfunc (c *client) extractArticle(ctx context.Context, articleURL string) (contentHTML, title string, err error) {\n\tbody, err := c.fetch(ctx, articleURL, maxArticleSize, false)\n\tif err != nil {\n\t\treturn \"\", \"\", err\n\t}\n\n\tpageURL, _ := url.Parse(articleURL)\n\tarticle, err := readability.FromReader(bytes.NewReader(body), pageURL)\n\tif err != nil {\n\t\treturn \"\", \"\", fmt.Errorf(\"readability parse: %w\", err)\n\t}\n\tif article.Node == nil {\n\t\treturn \"\", \"\", fmt.Errorf(\"no readable content extracted\")\n\t}\n\n\tvar buf bytes.Buffer\n\tif err := article.RenderHTML(&buf); err != nil {\n\t\treturn \"\", \"\", fmt.Errorf(\"render article html: %w\", err)\n\t}\n\treturn buf.String(), article.Title(), nil\n}\n","sourceCodeStart":102,"sourceCodeEnd":124,"githubUrl":"https://github.com/Tencent/WeKnora/blob/988cbb03305e055d8ebb7d46d9ac6cc0803cd074/internal/datasource/connector/rss/client.go#L102-L124","documentation":"Returned when article.RenderHTML(&buf) fails to serialize the extracted readability article node into HTML. This is rare: it occurs when the cleaned DOM cannot be written to the output writer — typically an underlying write error on the bytes.Buffer (which practically never fails) or serialization of a malformed node tree produced by the parser.","triggerScenarios":"A pathological page produces a readability node tree that the renderer cannot serialize; a bug or incompatibility in the go-readability v2 library version; out-of-memory conditions while growing the output buffer for a pathological article.","commonSituations":"Pages with deeply malformed or adversarial markup that survive parsing but break rendering; running an older go-readability build with a known rendering bug; extremely large extracted articles causing allocation failures.","solutions":["Upgrade codeberg.org/readeck/go-readability/v2 to the latest version — rendering bugs are fixed upstream regularly.","Treat this as per-item failure: fall back to feed-provided content in resolveItem and continue indexing other items.","If reproducible on a specific page, capture the HTML and file a minimal reproduction upstream.","Verify memory headroom on the host if the failure correlates with very large articles."],"exampleFix":"// before\ncontentHTML, title, err := cli.extractArticle(ctx, item.Link)\nif err != nil {\n    log.Fatal(err) // aborts whole walk\n}\n// after\ncontentHTML, title, err := cli.extractArticle(ctx, item.Link)\nif err != nil {\n    log.Warnf(\"article extraction failed (%v), using feed content\", err)\n    contentHTML, title = item.Content, item.Title\n}","handlingStrategy":"fallback","validationCode":null,"typeGuard":null,"tryCatchPattern":"contentHTML, title, err := cli.extractArticle(ctx, item.Link)\nif err != nil {\n    log.Warnf(\"render failed for %s: %v; using feed content\", item.Link, err)\n    contentHTML, title = item.Content, item.Title\n}","preventionTips":["Keep go-readability/v2 pinned to a recent version and update regularly.","Never abort a whole walk on a single item's render failure; degrade per item.","Sanitize pathological input pages upstream of extraction when feasible.","Log the article URL with the error so reproducible renderer bugs can be reported upstream."],"tags":["html","rendering","readability","rss"],"backgroundTag":"html-render-failed","analyzedSha":"988cbb03305e055d8ebb7d46d9ac6cc0803cd074","analyzedAt":"2026-09-02T14:41:08.344Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}