gastownhall/beads · error

marshaling HTML graph edges: %w

Error message

marshaling HTML graph edges: %w

What it means

Same failure mode as node marshaling but for the edges payload in the HTML graph visualization: json.Marshal on buildHTMLEdgeData output failed.

Source

Thrown at cmd/bd/graph_export.go:171

	default:
		return "❄"
	}
}

// renderGraphHTML generates a self-contained HTML file with an interactive D3.js
// force-directed graph visualization. The output is a complete HTML document that
// can be opened in any browser.
func renderGraphHTML(out io.Writer, layout *GraphLayout, subgraph *TemplateSubgraph) error {
	nodes := buildHTMLGraphData(layout, subgraph)
	edges := buildHTMLEdgeData(layout, subgraph)

	nodesJSON, err := json.Marshal(nodes)
	if err != nil {
		return fmt.Errorf("marshaling HTML graph nodes: %w", err)
	}
	edgesJSON, err := json.Marshal(edges)
	if err != nil {
		return fmt.Errorf("marshaling HTML graph edges: %w", err)
	}

	title := "Beads Dependency Graph"
	if subgraph.Root != nil {
		title = fmt.Sprintf("Beads: %s (%s)", subgraph.Root.Title, subgraph.Root.ID)
	}

	if _, err := fmt.Fprintf(out, htmlTemplate, html.EscapeString(title), string(nodesJSON), string(edgesJSON)); err != nil {
		return fmt.Errorf("writing HTML output: %w", err)
	}
	return nil
}

// HTMLNode is the JSON structure for a node in the HTML visualization
type HTMLNode struct {
	ID       string `json:"id"`
	Title    string `json:"title"`
	Status   string `json:"status"`

View on GitHub (pinned to 71377f2769)

Solutions

  1. Update/rebuild bd from a clean checkout
  2. Audit recent changes to HTMLEdgeData for unserializable field types
  3. File a bug with the wrapped error if on a stock release
Defensive patterns

Strategy: try-catch

Try / catch

if err := bd.Graph(ctx, "html"); err != nil {
  if strings.Contains(err.Error(), "marshaling HTML graph edges") {
    return bd.Graph(ctx, "dot") // JSON-free fallback
  }
  return err
}

Prevention

When it happens

Trigger: bd graph --format html where the computed edge structures contain values json.Marshal cannot encode.

Common situations: Same as nodes: custom builds with unmarshalable edge fields; upstream regression.

Related errors


AI-assisted analysis of gastownhall/beads@71377f2769 (2026-08-30). Data as JSON: /api/errors/7fb30ae2c0a5357c. Report an issue: GitHub.