{"record":{"id":"7fb30ae2c0a5357c","repo":"gastownhall/beads","slug":"marshaling-html-graph-edges-w","errorCode":null,"errorMessage":"marshaling HTML graph edges: %w","messagePattern":"marshaling HTML graph edges: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/bd/graph_export.go","lineNumber":171,"sourceCode":"\tdefault:\n\t\treturn \"❄\"\n\t}\n}\n\n// renderGraphHTML generates a self-contained HTML file with an interactive D3.js\n// force-directed graph visualization. The output is a complete HTML document that\n// can be opened in any browser.\nfunc renderGraphHTML(out io.Writer, layout *GraphLayout, subgraph *TemplateSubgraph) error {\n\tnodes := buildHTMLGraphData(layout, subgraph)\n\tedges := buildHTMLEdgeData(layout, subgraph)\n\n\tnodesJSON, err := json.Marshal(nodes)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"marshaling HTML graph nodes: %w\", err)\n\t}\n\tedgesJSON, err := json.Marshal(edges)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"marshaling HTML graph edges: %w\", err)\n\t}\n\n\ttitle := \"Beads Dependency Graph\"\n\tif subgraph.Root != nil {\n\t\ttitle = fmt.Sprintf(\"Beads: %s (%s)\", subgraph.Root.Title, subgraph.Root.ID)\n\t}\n\n\tif _, err := fmt.Fprintf(out, htmlTemplate, html.EscapeString(title), string(nodesJSON), string(edgesJSON)); err != nil {\n\t\treturn fmt.Errorf(\"writing HTML output: %w\", err)\n\t}\n\treturn nil\n}\n\n// HTMLNode is the JSON structure for a node in the HTML visualization\ntype HTMLNode struct {\n\tID       string `json:\"id\"`\n\tTitle    string `json:\"title\"`\n\tStatus   string `json:\"status\"`","sourceCodeStart":153,"sourceCodeEnd":189,"githubUrl":"https://github.com/gastownhall/beads/blob/71377f276968b452ee607177637970a4ff888584/cmd/bd/graph_export.go#L153-L189","documentation":"Same failure mode as node marshaling but for the edges payload in the HTML graph visualization: json.Marshal on buildHTMLEdgeData output failed.","triggerScenarios":"bd graph --format html where the computed edge structures contain values json.Marshal cannot encode.","commonSituations":"Same as nodes: custom builds with unmarshalable edge fields; upstream regression.","solutions":["Update/rebuild bd from a clean checkout","Audit recent changes to HTMLEdgeData for unserializable field types","File a bug with the wrapped error if on a stock release"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"if err := bd.Graph(ctx, \"html\"); err != nil {\n  if strings.Contains(err.Error(), \"marshaling HTML graph edges\") {\n    return bd.Graph(ctx, \"dot\") // JSON-free fallback\n  }\n  return err\n}","preventionTips":["Keep edge view-model structs JSON-serializable","Test renderGraphHTML with edge-heavy graphs after refactors","Update binaries rather than patching marshal paths"],"tags":["go","json","marshal","graph-export"],"backgroundTag":"json-marshal-failed","analyzedSha":"71377f276968b452ee607177637970a4ff888584","analyzedAt":"2026-08-30T18:55:39.744Z","schemaVersion":2},"datasetVersion":"2026-08-30T23:17:21.991Z"}