d2lang/d2 · critical
Failed to decompress SourceSansPro-Bold: %v
Error message
Failed to decompress SourceSansPro-Bold: %v
What it means
Same init()-time brotli decompression as the other embedded fonts, but for the SourceSansPro Bold face. A failed DecompressBrotli on the embedded bold font blob panics during package initialization. Cause is a corrupt/mismatched embedded asset in the wasm build.
Source
Thrown at d2renderers/d2fonts/d2fonts_embed_wasm.go:61
//go:embed encoded/FuzzyBubbles-Bold.txt.br
var fuzzyBubblesBoldBr []byte
//go:embed ttf/*
var fontFacesFS embed.FS
func init() {
FontEncodings = syncmap.New[Font, string]()
// Decompress and register SourceSansPro fonts
if str, err := compression.DecompressBrotli(sourceSansProRegularBr); err != nil {
panic(fmt.Sprintf("Failed to decompress SourceSansPro-Regular: %v", err))
} else {
FontEncodings.Set(Font{Family: SourceSansPro, Style: FONT_STYLE_REGULAR}, str)
}
if str, err := compression.DecompressBrotli(sourceSansProBoldBr); err != nil {
panic(fmt.Sprintf("Failed to decompress SourceSansPro-Bold: %v", err))
} else {
FontEncodings.Set(Font{Family: SourceSansPro, Style: FONT_STYLE_BOLD}, str)
}
if str, err := compression.DecompressBrotli(sourceSansProSemiboldBr); err != nil {
panic(fmt.Sprintf("Failed to decompress SourceSansPro-Semibold: %v", err))
} 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 {View on GitHub (pinned to 0d69dca6f5)
Solutions
- Verify and regenerate sourceSansProBoldBr (test decompression standalone)
- Re-run the project's font embedding/wasm build script from a clean checkout
- Confirm the brotli library version used at compression matches the decompressor
- Replace the asset from upstream if only this file is broken
Example fix
null
Defensive patterns
Strategy: fallback
Validate before calling
if _, err := compression.DecompressBrotli(sourceSansProBoldBr); err != nil {
return fmt.Errorf("broken embedded SourceSansPro-Bold asset: %w", err)
} Prevention
- Regenerate all font .br assets together, never individually with different tools
- Validate embedded assets decompress in CI before publishing the wasm artifact
- Keep the brotli compressor version aligned with the Go brotli decompressor
- Compare release artifacts against upstream for unexpected asset diffs
When it happens
Trigger: Package init of the wasm d2fonts build when sourceSansProBoldBr fails to decompress; occurs at wasm instantiation/load, before any rendering call.
Common situations: Regenerating font .br files with an incompatible brotli version; build pipeline embedding truncated or stale assets; editing embedded blobs by hand.
Related errors
- Failed to decompress SourceSansPro-Regular: %v
- Failed to decompress SourceSansPro-Semibold: %v
- Failed to decompress SourceSansPro-Italic: %v
- Failed to decompress SourceCodePro-Regular: %v
- Failed to decompress SourceCodePro-Bold: %v
AI-assisted analysis of d2lang/d2@0d69dca6f5 (2026-08-31).
Data as JSON: /api/errors/edd93697aa389ef1.
Report an issue: GitHub.