Tencent/WeKnora · error

chromium render failed: %w

Error message

chromium render failed: %w

What it means

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.

Source

Thrown at internal/infrastructure/web_fetch/fetcher.go:316

		chromedp.Flag("headless", true),
		chromedp.Flag("disable-setuid-sandbox", true),
		chromedp.Flag("disable-dev-shm-usage", true),
		chromedp.Flag("disable-gpu", true),
		chromedp.Flag("disable-blink-features", "AutomationControlled"),
	)
	allocatorCtx, cancelAllocator := chromedp.NewExecAllocator(ctx, opts...)
	defer cancelAllocator()
	browserCtx, cancelBrowser := chromedp.NewContext(allocatorCtx)
	defer cancelBrowser()
	browserCtx, cancelTimeout := context.WithTimeout(browserCtx, fetchTimeout)
	defer cancelTimeout()
	var html string
	if err := chromedp.Run(browserCtx,
		chromedp.Navigate(target.URL.String()),
		chromedp.WaitReady("body", chromedp.ByQuery),
		chromedp.OuterHTML("html", &html),
	); err != nil {
		return "", fmt.Errorf("chromium render failed: %w", err)
	}
	return string(limitBytes([]byte(html), maxBodySize)), nil
}

func limitBytes(value []byte, max int64) []byte {
	if int64(len(value)) <= max {
		return value
	}
	return value[:max]
}

func needsBrowserFallback(content string, html []byte) bool {
	trimmed := strings.TrimSpace(strings.ToLower(content))
	if trimmed == "" || strings.Contains(trimmed, "enable javascript") || strings.Contains(trimmed, "loading...") {
		return true
	}
	if len([]rune(trimmed)) >= 200 {
		return false

View on GitHub (pinned to 988cbb0330)

Solutions

  1. Verify Chromium/Chrome is installed and the flags are valid for its version
  2. Check /dev/shm size and headless compatibility in the container
  3. Increase fetchTimeout for slow pages
  4. Fall back to plain HTTP fetch instead of browser rendering
Defensive patterns

Strategy: fallback

When it happens

Trigger: Thrown at internal/infrastructure/web_fetch/fetcher.go:316 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of Tencent/WeKnora@988cbb0330 (2026-09-02). Data as JSON: /api/errors/8f0efa32a93a6a9a. Report an issue: GitHub.