{"record":{"id":"5eb9d4483b554e86","repo":"d2lang/d2","slug":"failed-to-decompress-sourcesanspro-semibold-v","errorCode":null,"errorMessage":"Failed to decompress SourceSansPro-Semibold: %v","messagePattern":"Failed to decompress SourceSansPro-Semibold: (.+?)","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"critical","filePath":"d2renderers/d2fonts/d2fonts_embed_wasm.go","lineNumber":67,"sourceCode":"\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 {\n\t\tpanic(fmt.Sprintf(\"Failed to decompress SourceCodePro-Regular: %v\", err))\n\t} else {\n\t\tFontEncodings.Set(Font{Family: SourceCodePro, Style: FONT_STYLE_REGULAR}, str)\n\t}\n\n\tif str, err := compression.DecompressBrotli(sourceCodeProBoldBr); err != nil {","sourceCodeStart":49,"sourceCodeEnd":85,"githubUrl":"https://github.com/d2lang/d2/blob/0d69dca6f532ceaeacd615d35d1eaa41a238ffdb/d2renderers/d2fonts/d2fonts_embed_wasm.go#L49-L85","documentation":"init()-time panic in the wasm d2fonts package when the embedded brotli-compressed SourceSansPro Semibold font fails to decompress. The font cannot be registered in FontEncodings, so the module aborts at load time.","triggerScenarios":"Package init of the wasm build when compression.DecompressBrotli(sourceSansProSemiboldBr) returns an error — corrupt, empty, or toolchain-incompatible embedded asset.","commonSituations":"Custom wasm builds with mis-generated semibold .br asset; bundler stripping/corrupting embedded binary assets; partial git checkout of binary files.","solutions":["Validate sourceSansProSemiboldBr decompresses with a standalone brotli tool","Regenerate the .br asset via the project's embed script","Rebuild wasm from a clean upstream checkout","Check bundler config isn't mangling embedded binary blobs"],"exampleFix":null,"handlingStrategy":"fallback","validationCode":"if _, err := compression.DecompressBrotli(sourceSansProSemiboldBr); err != nil {\n    return fmt.Errorf(\"broken embedded SourceSansPro-Semibold asset: %w\", err)\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Regenerate all font .br assets together","Validate assets in CI before publishing","Keep brotli toolchain versions consistent","Rebuild from clean checkouts to avoid stale binaries"],"tags":["wasm","fonts","brotli","init-panic"],"backgroundTag":"brotli-decompression-failed","analyzedSha":"0d69dca6f532ceaeacd615d35d1eaa41a238ffdb","analyzedAt":"2026-08-31T12:19:21.182Z","schemaVersion":2},"datasetVersion":"2026-09-01T08:17:40.651Z"}