{"record":{"id":"9c2f7b9c9679347f","repo":"d2lang/d2","slug":"failed-to-fully-scompile-rendering-partial-svg","errorCode":null,"errorMessage":"failed to fully %scompile (rendering partial svg): %w","messagePattern":"failed to fully (.+?)compile \\(rendering partial svg\\): %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"d2cli/watch.go","lineNumber":451,"sourceCode":"\t\t\t\t\tErr: broadcastErr.Error(),\n\t\t\t\t})\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tw.pw = newPW\n\t\t}\n\n\t\tfs := trackedFS{}\n\t\tw.boardpathMu.Lock()\n\t\tvar boardPath []string\n\t\tif w.boardPath != \"\" {\n\t\t\tboardPath = strings.Split(w.boardPath, string(os.PathSeparator))\n\t\t}\n\t\tsvg, _, err := compile(ctx, w.ms, w.plugins, &fs, w.layout, w.renderOpts, w.fontFamily, w.monoFontFamily, w.animateInterval, w.inputPath, w.outputPath, boardPath, false, w.bundle, w.forceAppendix, w.pw.Browser, w.outputFormat, w.asciiMode)\n\t\tw.boardpathMu.Unlock()\n\t\terrs := \"\"\n\t\tif err != nil {\n\t\t\tif len(svg) > 0 {\n\t\t\t\terr = fmt.Errorf(\"failed to fully %scompile (rendering partial svg): %w\", recompiledPrefix, err)\n\t\t\t} else {\n\t\t\t\terr = fmt.Errorf(\"failed to %scompile: %w\", recompiledPrefix, err)\n\t\t\t}\n\t\t\terrs = err.Error()\n\t\t\tw.ms.Log.Error.Print(errs)\n\t\t}\n\t\terr = w.replaceWatchList(ctx, fs.opened)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tw.broadcast(&compileResult{\n\t\t\tSVG:   string(svg),\n\t\t\tScale: w.renderOpts.Scale,\n\t\t\tErr:   errs,\n\t\t})\n\n\t\tif firstCompile {","sourceCodeStart":433,"sourceCodeEnd":469,"githubUrl":"https://github.com/d2lang/d2/blob/0d69dca6f532ceaeacd615d35d1eaa41a238ffdb/d2cli/watch.go#L433-L469","documentation":"During watch recompilation, compile() may fail after it has already produced a partial SVG. Watch wraps the original error with the prefix \"failed to fully <re>compile (rendering partial svg)\" so the user knows an incomplete (partial) diagram was rendered from a full or recompile.","triggerScenarios":"compile() returns both a non-empty svg and an error — e.g. one board of a multi-board diagram fails while others rendered, or a downstream render step (export/animation) fails after SVG generation.","commonSituations":"Syntax or semantic errors in part of a .d2 file being edited in watch mode, invalid style values on some shapes, or an export step failing after the SVG was built.","solutions":["Fix the underlying wrapped error shown after the %w portion (it names the actual failing element/key)","Check the referenced shape/key in your .d2 source for invalid values","Save a valid file so watch performs a clean recompile"],"exampleFix":"// before\nx.style.fill-pattern: stripes   # invalid\n// after\nx.style.fill-pattern: dots","handlingStrategy":"validation","validationCode":"// run a one-shot compile to validate before watching:\n// d2 file.d2 /tmp/out.svg && d2 file.d2 --watch","typeGuard":null,"tryCatchPattern":"if strings.Contains(errStr, \"failed to fully\") {\n\t// partial svg rendered: fix the wrapped cause, watch will re-render fully\n}","preventionTips":["Fix the wrapped underlying error first — it names the failing element","Validate .d2 files with a non-watch run before long watch sessions","Keep multi-board files syntactically consistent while editing"],"tags":["watch-mode","compile","partial-render"],"backgroundTag":"partial-render-error","analyzedSha":"0d69dca6f532ceaeacd615d35d1eaa41a238ffdb","analyzedAt":"2026-08-31T12:19:21.182Z","schemaVersion":2},"datasetVersion":"2026-08-31T14:17:45.589Z"}