{"record":{"id":"edd93697aa389ef1","repo":"d2lang/d2","slug":"failed-to-decompress-sourcesanspro-bold-v","errorCode":null,"errorMessage":"Failed to decompress SourceSansPro-Bold: %v","messagePattern":"Failed to decompress SourceSansPro-Bold: (.+?)","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"critical","filePath":"d2renderers/d2fonts/d2fonts_embed_wasm.go","lineNumber":61,"sourceCode":"\n//go:embed encoded/FuzzyBubbles-Bold.txt.br\nvar fuzzyBubblesBoldBr []byte\n\n//go:embed ttf/*\nvar fontFacesFS embed.FS\n\nfunc init() {\n\tFontEncodings = syncmap.New[Font, string]()\n\n\t// Decompress and register SourceSansPro fonts\n\tif str, err := compression.DecompressBrotli(sourceSansProRegularBr); err != nil {\n\t\tpanic(fmt.Sprintf(\"Failed to decompress SourceSansPro-Regular: %v\", err))\n\t} else {\n\t\tFontEncodings.Set(Font{Family: SourceSansPro, Style: FONT_STYLE_REGULAR}, str)\n\t}\n\n\tif str, err := compression.DecompressBrotli(sourceSansProBoldBr); err != nil {\n\t\tpanic(fmt.Sprintf(\"Failed to decompress SourceSansPro-Bold: %v\", err))\n\t} else {\n\t\tFontEncodings.Set(Font{Family: SourceSansPro, Style: FONT_STYLE_BOLD}, str)\n\t}\n\n\tif str, err := compression.DecompressBrotli(sourceSansProSemiboldBr); err != nil {\n\t\tpanic(fmt.Sprintf(\"Failed to decompress SourceSansPro-Semibold: %v\", err))\n\t} else {\n\t\tFontEncodings.Set(Font{Family: SourceSansPro, Style: FONT_STYLE_SEMIBOLD}, str)\n\t}\n\n\tif str, err := compression.DecompressBrotli(sourceSansProItalicBr); err != nil {\n\t\tpanic(fmt.Sprintf(\"Failed to decompress SourceSansPro-Italic: %v\", err))\n\t} else {\n\t\tFontEncodings.Set(Font{Family: SourceSansPro, Style: FONT_STYLE_ITALIC}, str)\n\t}\n\n\t// Decompress and register SourceCodePro fonts\n\tif str, err := compression.DecompressBrotli(sourceCodeProRegularBr); err != nil {","sourceCodeStart":43,"sourceCodeEnd":79,"githubUrl":"https://github.com/d2lang/d2/blob/0d69dca6f532ceaeacd615d35d1eaa41a238ffdb/d2renderers/d2fonts/d2fonts_embed_wasm.go#L43-L79","documentation":"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.","triggerScenarios":"Package init of the wasm d2fonts build when sourceSansProBoldBr fails to decompress; occurs at wasm instantiation/load, before any rendering call.","commonSituations":"Regenerating font .br files with an incompatible brotli version; build pipeline embedding truncated or stale assets; editing embedded blobs by hand.","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"],"exampleFix":"null","handlingStrategy":"fallback","validationCode":"if _, err := compression.DecompressBrotli(sourceSansProBoldBr); err != nil {\n    return fmt.Errorf(\"broken embedded SourceSansPro-Bold asset: %w\", err)\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["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"],"tags":["wasm","fonts","brotli","init-panic"],"backgroundTag":"brotli-decompression-failed","analyzedSha":"0d69dca6f532ceaeacd615d35d1eaa41a238ffdb","analyzedAt":"2026-08-31T12:19:21.182Z","schemaVersion":2},"datasetVersion":"2026-08-31T14:17:45.589Z"}