{"record":{"id":"8f0efa32a93a6a9a","repo":"Tencent/WeKnora","slug":"chromium-render-failed-w","errorCode":null,"errorMessage":"chromium render failed: %w","messagePattern":"chromium render failed: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/infrastructure/web_fetch/fetcher.go","lineNumber":316,"sourceCode":"\t\tchromedp.Flag(\"headless\", true),\n\t\tchromedp.Flag(\"disable-setuid-sandbox\", true),\n\t\tchromedp.Flag(\"disable-dev-shm-usage\", true),\n\t\tchromedp.Flag(\"disable-gpu\", true),\n\t\tchromedp.Flag(\"disable-blink-features\", \"AutomationControlled\"),\n\t)\n\tallocatorCtx, cancelAllocator := chromedp.NewExecAllocator(ctx, opts...)\n\tdefer cancelAllocator()\n\tbrowserCtx, cancelBrowser := chromedp.NewContext(allocatorCtx)\n\tdefer cancelBrowser()\n\tbrowserCtx, cancelTimeout := context.WithTimeout(browserCtx, fetchTimeout)\n\tdefer cancelTimeout()\n\tvar html string\n\tif err := chromedp.Run(browserCtx,\n\t\tchromedp.Navigate(target.URL.String()),\n\t\tchromedp.WaitReady(\"body\", chromedp.ByQuery),\n\t\tchromedp.OuterHTML(\"html\", &html),\n\t); err != nil {\n\t\treturn \"\", fmt.Errorf(\"chromium render failed: %w\", err)\n\t}\n\treturn string(limitBytes([]byte(html), maxBodySize)), nil\n}\n\nfunc limitBytes(value []byte, max int64) []byte {\n\tif int64(len(value)) <= max {\n\t\treturn value\n\t}\n\treturn value[:max]\n}\n\nfunc needsBrowserFallback(content string, html []byte) bool {\n\ttrimmed := strings.TrimSpace(strings.ToLower(content))\n\tif trimmed == \"\" || strings.Contains(trimmed, \"enable javascript\") || strings.Contains(trimmed, \"loading...\") {\n\t\treturn true\n\t}\n\tif len([]rune(trimmed)) >= 200 {\n\t\treturn false","sourceCodeStart":298,"sourceCodeEnd":334,"githubUrl":"https://github.com/Tencent/WeKnora/blob/988cbb03305e055d8ebb7d46d9ac6cc0803cd074/internal/infrastructure/web_fetch/fetcher.go#L298-L334","documentation":"Fired in renderWithChromium when chromedp.Run fails — Chromium could not launch, navigate to the target, or execute the rendering actions within fetchTimeout. Causes include missing Chrome binary, sandbox/shared-memory flags issues, page crash, or context timeout.","triggerScenarios":"Thrown at internal/infrastructure/web_fetch/fetcher.go:316 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Verify Chromium/Chrome is installed and the flags are valid for its version","Check /dev/shm size and headless compatibility in the container","Increase fetchTimeout for slow pages","Fall back to plain HTTP fetch instead of browser rendering"],"exampleFix":null,"handlingStrategy":"fallback","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-08T15:18:49.778Z"}