{"record":{"id":"3cdf03eee872fc20","repo":"d2lang/d2","slug":"render-target-s-not-found","errorCode":null,"errorMessage":"render target \"%s\" not found","messagePattern":"render target \"(.+?)\" not found","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"d2cli/main.go","lineNumber":560,"sourceCode":"\t\tfmt.Print(string(jsonOutput))\n\t\tos.Exit(42)\n\t\treturn nil, false, nil\n\t}\n\n\tcancel := background.Repeat(func() {\n\t\tms.Log.Info.Printf(\"compiling & running layout algorithms...\")\n\t}, time.Second*5)\n\tdefer cancel()\n\n\trootDiagram, g, err := d2lib.Compile(ctx, string(input), opts, &renderOpts)\n\tif err != nil {\n\t\treturn nil, false, err\n\t}\n\tcancel()\n\n\tdiagram := rootDiagram.GetBoard(boardPath)\n\tif diagram == nil {\n\t\treturn nil, false, fmt.Errorf(`render target \"%s\" not found`, strings.Join(boardPath, \".\"))\n\t}\n\tif noChildren {\n\t\tdiagram.Layers = nil\n\t\tdiagram.Scenarios = nil\n\t\tdiagram.Steps = nil\n\t}\n\n\tplugin, _ := d2plugin.FindPlugin(ctx, plugins, *opts.Layout)\n\n\tif animateInterval > 0 {\n\t\tmasterID, err := diagram.HashID(renderOpts.Salt)\n\t\tif err != nil {\n\t\t\treturn nil, false, err\n\t\t}\n\t\trenderOpts.MasterID = masterID\n\t}\n\n\tpinfo, err := plugin.Info(ctx)","sourceCodeStart":542,"sourceCodeEnd":578,"githubUrl":"https://github.com/d2lang/d2/blob/0d69dca6f532ceaeacd615d35d1eaa41a238ffdb/d2cli/main.go#L542-L578","documentation":"compile() resolves the board to render via rootDiagram.GetBoard(boardPath). When no board matches the dotted path given by --board, diagram is nil and compile returns 'render target \"<path>\" not found'.","triggerScenarios":"Running d2 with a --board flag whose name doesn't match any layer/scenario/step in the diagram, e.g. 'd2 --board layers.foo input.d2 out.svg'.","commonSituations":"Typos or wrong nesting order in the board path, boards renamed after the flag was written, using dots in board names that collide with path separators.","solutions":["List the boards in the .d2 file and correct the --board path (join nested boards with '.')","Remove the --board flag to render the root board","Escape/rename boards whose names contain dots or special characters"],"exampleFix":"// before\nd2 --board lyaers.main input.d2 out.svg\n// after\nd2 --board layers.main input.d2 out.svg","handlingStrategy":"validation","validationCode":"// pre-check board names in your .d2 source against the --board path\nnames := collectBoardNames(source) // layers/scenarios/steps\nif !containsPath(names, strings.Split(boardFlag, \".\")) {\n    return fmt.Errorf(\"board %q does not exist\", boardFlag)\n}","typeGuard":null,"tryCatchPattern":"if _, _, err := compile(...); err != nil && strings.Contains(err.Error(), \"not found\") {\n    return fmt.Errorf(\"check --board path %q: %w\", boardFlag, err)\n}","preventionTips":["Mirror board names between the .d2 file and --board flag exactly","Remember nested boards are joined with '.' in order","Rename boards carefully and update any scripts using --board"],"tags":["go","cli","board","validation"],"backgroundTag":"render-target-not-found","analyzedSha":"0d69dca6f532ceaeacd615d35d1eaa41a238ffdb","analyzedAt":"2026-08-31T12:19:21.182Z","schemaVersion":2},"datasetVersion":"2026-08-31T14:17:45.589Z"}