d2lang/d2 · critical
Failed to decompress SourceSansPro-Italic: %v
Error message
Failed to decompress SourceSansPro-Italic: %v
What it means
init()-time panic in the wasm d2fonts package when the embedded brotli-compressed SourceSansPro Italic font fails to decompress. Registration into FontEncodings never happens and the whole module fails to initialize.
Source
Thrown at d2renderers/d2fonts/d2fonts_embed_wasm.go:73
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 {
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 {View on GitHub (pinned to 0d69dca6f5)
Solutions
- Test sourceSansProItalicBr with a standalone brotli decompressor
- Regenerate the italic .br asset from the original TTF
- Rebuild the wasm artifact from a clean checkout
- Compare embedded bytes against upstream d2 to spot corruption
Defensive patterns
Strategy: fallback
Validate before calling
if _, err := compression.DecompressBrotli(sourceSansProItalicBr); err != nil {
return fmt.Errorf("broken embedded SourceSansPro-Italic asset: %w", err)
} Prevention
- Regenerate all font .br assets together
- Validate assets in CI before publishing
- Keep brotli toolchain versions consistent
- Rebuild from clean checkouts
When it happens
Trigger: Package init of the wasm build when compression.DecompressBrotli(sourceSansProItalicBr) errors — corrupt or invalid embedded brotli bytes.
Common situations: Broken build artifacts; incomplete embed (go:embed missing file replaced by placeholder); incompatible brotli compression settings when regenerating assets.
Related errors
- Failed to decompress SourceSansPro-Regular: %v
- Failed to decompress SourceSansPro-Bold: %v
- Failed to decompress SourceSansPro-Semibold: %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/c83b9be17597612b.
Report an issue: GitHub.