{"record":{"id":"5b9b7c7569e3541c","repo":"Graphify-Labs/graphify","slug":"diagnostic-input-must-be-a-json-object","errorCode":null,"errorMessage":"diagnostic input must be a JSON object","messagePattern":"diagnostic input must be a JSON object","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"graphify/diagnostics.py","lineNumber":294,"sourceCode":"        \"examples\": examples,\n    }\n\n\ndef _read_json_file(path: str | Path) -> dict[str, Any]:\n    \"\"\"Read a JSON graph after applying Graphify's graph-load size cap.\"\"\"\n    from graphify.security import check_graph_file_size_cap\n\n    json_path = Path(path)\n    check_graph_file_size_cap(json_path)\n    try:\n        data = json.loads(json_path.read_text(encoding=\"utf-8\"))\n    except (json.JSONDecodeError, OSError) as exc:\n        raise RuntimeError(\n            f\"Cannot parse {json_path}: {exc}. \"\n            \"The file may be corrupted — re-run 'graphify extract'.\"\n        ) from exc\n    if not isinstance(data, dict):\n        raise ValueError(\"diagnostic input must be a JSON object\")\n    return data\n\n\ndef diagnose_file(\n    path: str | Path,\n    *,\n    directed: bool | None = None,\n    root: str | Path | None = None,\n    max_examples: int = 5,\n    extract_path: str | Path | None = None,\n) -> dict[str, Any]:\n    \"\"\"Diagnose a graph/extraction JSON file without mutating it.\n\n    When `directed` is None, the JSON's \"directed\" flag is honored. Raw\n    extraction JSON that has no \"directed\" flag defaults to directed analysis.\n    \"\"\"\n    data = _read_json_file(path)\n    if directed is None:","sourceCodeStart":276,"sourceCodeEnd":312,"githubUrl":"https://github.com/Graphify-Labs/graphify/blob/7fe58b0b0f3873be9a21c30106b8b8527c353aa6/graphify/diagnostics.py#L276-L312","documentation":"Graph-existence preflight in the shared query reference (tools/skillgen/fragments/references/query/default.md:18), used by /graphify query before any BFS/DFS work. A Python one-liner raises SystemExit(1) with this message when graphify-out/graph.json is missing; the skill then instructs the agent to stop and tell the user to run /graphify <path> first.","triggerScenarios":"Executing the query flow (including its Step 0 constrained query expansion, which reads the graph vocabulary) when graphify-out/graph.json does not exist in the current directory — never built, cleaned, wrong cwd, or a build that exited before export.","commonSituations":"Asking graph questions on a fresh clone; agent running from a subdirectory while the graph lives at repo root; CI cleanup removing graphify-out/; an earlier build failing at the empty-graph or shrink guard so graph.json was never persisted.","solutions":["Run /graphify <path> against the codebase, wait for a successful build, then re-run the query.","Confirm the relative path graphify-out/graph.json resolves from the current working directory.","If the previous build failed, fix its root cause (empty extraction or shrink refusal) — no graph was written.","Treat cleanup tools that delete graphify-out/ as invalidating all graph queries until a rebuild."],"exampleFix":"# before\n/graphify query \"where is rate limiting applied?\"\n# ERROR: No graph found ...\n\n# after\n/graphify .\n/graphify query \"where is rate limiting applied?\"","handlingStrategy":"validation","validationCode":"from pathlib import Path\n\nif not Path('graphify-out/graph.json').is_file():\n    print('ERROR: No graph found - run /graphify <path> first; aborting query flow.')\n    raise SystemExit(1)\nprint('graph present - proceed to Step 0 vocabulary extraction')","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always run the graph-exists preflight before Step 0 query expansion and traversal.","Build the graph before any query session in a new workspace.","Anchor the agent to the working directory that owns graphify-out/.","Treat graphify-out/ deletion as a hard invalidation of all graph queries until rebuilt."],"tags":["graphify","preflight","missing-file","query","skillgen"],"backgroundTag":null,"analyzedSha":"7fe58b0b0f3873be9a21c30106b8b8527c353aa6","analyzedAt":"2026-08-14T19:23:21.323Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}