Skip to content

fix: clear error when the code map cannot be read - #327

Closed
vibgrate-team wants to merge 2 commits into
mainfrom
cursor/graph-load-errors-e030
Closed

vibgrate-team wants to merge 2 commits into
mainfrom
cursor/graph-load-errors-e030

Conversation

@vibgrate-team

@vibgrate-team vibgrate-team commented Oct 3, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Commands that load the code map (vg show, vg impact, vg ask, and the other readers of graph.json) used to fail opaquely when the file was truncated, not valid JSON, or written with a schema this version cannot read. A bad file was reported as a missing map, or the process printed a parser error that quoted the file.

Those commands now stop with exit code 1. The message names the failure — truncated, not valid JSON, or a schema this version cannot read — and says to rebuild with vg build. It does not include the file contents.

A map that is simply absent is still reported as missing (exit 3, no map found). Maps this version already reads (vg-graph/1.0 and vg-graph/1.1) still load.

Related issues

Fixes #274

Checklist

  • pnpm test passes
  • pnpm lint is clean
  • pnpm typecheck is clean
  • Docs updated (README / DOCS / ARCHITECTURE) where behavior changed
  • Determinism preserved — identical input still produces identical graph.json / report output (content-hashed IDs, stable sorts; no time, randomness, or filesystem-order dependence)
  • No proprietary or internal references — public, Apache-2.0 content only
  • Commits use Conventional Commits and are signed off (git commit -s, DCO)

Notes for reviewers

The check lives in the shared loader, so every command that reads the map gets the same error. A binary snapshot is still a cache: a corrupt snapshot falls back to graph.json, and a snapshot whose schema this version cannot read fails the same way the JSON would.

Open in Web Open in Cursor 

cursoragent and others added 2 commits October 3, 2026 15:17
Commands that read graph.json treated a truncated file, invalid JSON, or
an unsupported schema as a missing map, or printed a parser error that
quoted the file. They now exit 1, name which failure it is, and say to
rebuild with `vg build`. A missing map is still reported as missing.
vg-graph/1.0 and vg-graph/1.1 still load.

Fixes #274

Signed-off-by: Cursor Agent <cursoragent@cursor.com>

Co-authored-by: vibgrate-team <vibgrate-team@users.noreply.github.com>
GraphSource.get now refuses a map with no schema. The freshness tests
only need a readable file so the probe can run.

Signed-off-by: Cursor Agent <cursoragent@cursor.com>

Co-authored-by: vibgrate-team <vibgrate-team@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug: actionable error when graph.json is corrupt or schema-mismatched

2 participants