{"record":{"id":"0a06c46d959dd15d","repo":"d2lang/d2","slug":"failed-to-decompress-sourcecodepro-regular-v","errorCode":null,"errorMessage":"Failed to decompress SourceCodePro-Regular: %v","messagePattern":"Failed to decompress SourceCodePro-Regular: (.+?)","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"critical","filePath":"d2renderers/d2fonts/d2fonts_embed_wasm.go","lineNumber":80,"sourceCode":"\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 {\n\t\tpanic(fmt.Sprintf(\"Failed to decompress SourceCodePro-Bold: %v\", err))\n\t} else {\n\t\tFontEncodings.Set(Font{Family: SourceCodePro, Style: FONT_STYLE_BOLD}, str)\n\t}\n\n\tif str, err := compression.DecompressBrotli(sourceCodeProSemiboldBr); err != nil {\n\t\tpanic(fmt.Sprintf(\"Failed to decompress SourceCodePro-Semibold: %v\", err))\n\t} else {\n\t\tFontEncodings.Set(Font{Family: SourceCodePro, Style: FONT_STYLE_SEMIBOLD}, str)\n\t}\n\n\tif str, err := compression.DecompressBrotli(sourceCodeProItalicBr); err != nil {\n\t\tpanic(fmt.Sprintf(\"Failed to decompress SourceCodePro-Italic: %v\", err))","sourceCodeStart":62,"sourceCodeEnd":98,"githubUrl":"https://github.com/d2lang/d2/blob/0d69dca6f532ceaeacd615d35d1eaa41a238ffdb/d2renderers/d2fonts/d2fonts_embed_wasm.go#L62-L98","documentation":"init()-time panic in the wasm d2fonts package when the embedded brotli-compressed SourceCodePro Regular font fails to decompress. Like the other embedded fonts, failure here aborts module initialization before any rendering can occur.","triggerScenarios":"Package init of the wasm build when compression.DecompressBrotli(sourceCodeProRegularBr) returns an error due to corrupt/empty/mismatched embedded asset.","commonSituations":"Faulty asset generation in the wasm build pipeline; truncated embedded files; version mismatch between brotli compressor and the Go brotli decompressor.","solutions":["Verify sourceCodeProRegularBr decompresses with a standalone tool","Regenerate the .br asset using the project's embed script","Rebuild wasm from a clean checkout of d2","Align brotli tool versions with the project's documented toolchain"],"exampleFix":null,"handlingStrategy":"fallback","validationCode":"if _, err := compression.DecompressBrotli(sourceCodeProRegularBr); err != nil {\n    return fmt.Errorf(\"broken embedded SourceCodePro-Regular 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"],"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"}