d2lang/d2 · critical

Failed to decompress SourceCodePro-Bold: %v

Error message

Failed to decompress SourceCodePro-Bold: %v

What it means

init()-time panic in the wasm d2fonts package when the embedded brotli-compressed SourceCodePro Bold font fails to decompress, preventing registration of the bold monospace face and aborting module load.

Source

Thrown at d2renderers/d2fonts/d2fonts_embed_wasm.go:86

	} else {
		FontEncodings.Set(Font{Family: SourceSansPro, Style: FONT_STYLE_SEMIBOLD}, str)
	}

	if str, err := compression.DecompressBrotli(sourceSansProItalicBr); err != nil {
		panic(fmt.Sprintf("Failed to decompress SourceSansPro-Italic: %v", err))
	} else {
		FontEncodings.Set(Font{Family: SourceSansPro, Style: FONT_STYLE_ITALIC}, str)
	}

	// Decompress and register SourceCodePro fonts
	if str, err := compression.DecompressBrotli(sourceCodeProRegularBr); err != nil {
		panic(fmt.Sprintf("Failed to decompress SourceCodePro-Regular: %v", err))
	} else {
		FontEncodings.Set(Font{Family: SourceCodePro, Style: FONT_STYLE_REGULAR}, str)
	}

	if str, err := compression.DecompressBrotli(sourceCodeProBoldBr); err != nil {
		panic(fmt.Sprintf("Failed to decompress SourceCodePro-Bold: %v", err))
	} else {
		FontEncodings.Set(Font{Family: SourceCodePro, Style: FONT_STYLE_BOLD}, str)
	}

	if str, err := compression.DecompressBrotli(sourceCodeProSemiboldBr); err != nil {
		panic(fmt.Sprintf("Failed to decompress SourceCodePro-Semibold: %v", err))
	} else {
		FontEncodings.Set(Font{Family: SourceCodePro, Style: FONT_STYLE_SEMIBOLD}, str)
	}

	if str, err := compression.DecompressBrotli(sourceCodeProItalicBr); err != nil {
		panic(fmt.Sprintf("Failed to decompress SourceCodePro-Italic: %v", err))
	} else {
		FontEncodings.Set(Font{Family: SourceCodePro, Style: FONT_STYLE_ITALIC}, str)
	}

	// Decompress and register FuzzyBubbles fonts
	if str, err := compression.DecompressBrotli(fuzzyBubblesRegularBr); err != nil {

View on GitHub (pinned to 0d69dca6f5)

Solutions

  1. Standalone-decompress sourceCodeProBoldBr to confirm validity
  2. Regenerate the bold .br asset and rebuild the wasm module
  3. Rebuild from clean upstream sources
  4. Check that the brotli compressor settings (e.g. quality/window) match what DecompressBrotli expects
Defensive patterns

Strategy: fallback

Validate before calling

if _, err := compression.DecompressBrotli(sourceCodeProBoldBr); err != nil {
    return fmt.Errorf("broken embedded SourceCodePro-Bold asset: %w", err)
}

Prevention

When it happens

Trigger: Package init of the wasm build when compression.DecompressBrotli(sourceCodeProBoldBr) errors — typically a broken embedded asset in a custom or corrupted build.

Common situations: Regenerated .br assets with incompatible settings; bundler/build corruption of embedded binaries; incomplete git-lfs style checkouts of binary assets.

Related errors


AI-assisted analysis of d2lang/d2@0d69dca6f5 (2026-08-31). Data as JSON: /api/errors/7ea4067803db635d. Report an issue: GitHub.