Skip to content

export obsidian writes empty graph.canvas (32 bytes) on a populated graph #1324

Closed

Description

@mohamedtlilidev

Summary

graphify export obsidian writes 1,679 markdown notes correctly, but the companion graph.canvas file is always 32 bytes of empty JSON:

{
  "nodes": [],
  "edges": []
}

This happens regardless of graph size — the underlying graph.json has 1,708 nodes and 3,173 links, and the markdown notes contain valid [[wikilinks]], but none of that data is reflected in the Canvas.

Repro

graphify .                       # full pipeline on any non-trivial repo
graphify export obsidian
cat graphify-out/obsidian/graph.canvas
# → {"nodes": [], "edges": []}

Re-running graphify export obsidian after deleting the canvas file produces the same empty output. Deterministic.

Environment

  • graphify 0.8.39 (installed via pip to ~/.local/bin/graphify)
  • Linux 6.8.0 / Ubuntu, Python 3
  • Corpus: FastAPI + Next.js monorepo, ~1.7k nodes / 3.1k links

Expected

graph.canvas should contain Canvas nodes (one per markdown note, with x/y positions and a file reference to the .md path) and Canvas edges built from the graph's links, so opening the vault and double-clicking graph.canvas shows the spatial cluster layout.

Workaround

Obsidian's built-in Graph View (Ctrl/Cmd+G) renders fine because it reads the [[wikilinks]] inside each note — those are written correctly. Only the pre-positioned Canvas board is broken.

Notes

  • graph.html (force-directed view from graph.json) works correctly on the same graph
  • The 32-byte size hints the canvas writer is producing the empty shell before the node-emission loop runs (or the loop has a guard that always evaluates false)

Activity

  1. safishamsi commented on Jun 17, 2026

    @safishamsi
    Member

    Fixed in 9c8bd4d (branch v8).

    Root cause: to_canvas built cards/edges solely by iterating the communities dict (export.py), while to_obsidian iterates G.nodes() directly. When communities is empty - which happens on --no-cluster builds and whenever there's no .graphify_analysis.json sidecar and every node's community is null - the canvas loops produced nothing and it wrote the empty {"nodes": [], "edges": []} shell, which serializes to exactly 32 bytes. That's why the notes and wikilinks were fine but only the canvas was empty.

    Fix: when communities is empty on a populated graph, fall back to one synthetic community containing every node, so the canvas always reflects the graph.

    Verified: reproduced the 32-byte empty canvas with community: null nodes + no sidecar; after the fix the same graph yields a populated canvas (e.g. 1573 bytes, 5 nodes, 5 edges via export obsidian on a --no-cluster build). Regression test added (test_to_canvas_no_communities_still_populates); full suite green (2113 passed).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions