Graphify-Labs/graphify · error · ImportError

--cargo on Python 3.10 needs tomli. Install with: pip instal

Error message

--cargo on Python 3.10 needs tomli. Install with: pip install tomli

What it means

Empty-graph fail-fast in the devin-flavored fragment (tools/skillgen/fragments/core/devin.md:477). It loads graphify-out/-prefixed sidecars, builds the graph with build_from_json(extraction, directed=IS_DIRECTED) (no root= parameter in this variant), and exits 1 when the graph has zero nodes before cluster/export/report run (#1392).

Source

Thrown at graphify/cargo_introspect.py:19

"""Cargo manifest introspection for workspace-internal crate dependencies."""

from __future__ import annotations

from pathlib import Path
from typing import Any


_CONFIDENCE_EXTRACTED = "EXTRACTED"


def _load_toml(path: Path) -> dict[str, Any]:
    try:
        import tomllib  # type: ignore[import-not-found]
    except ModuleNotFoundError:
        try:
            import tomli as tomllib  # type: ignore[import-not-found,no-redef]
        except ModuleNotFoundError:
            raise ImportError(
                "--cargo on Python 3.10 needs tomli. Install with: pip install tomli"
            ) from None

    with path.open("rb") as manifest:
        return tomllib.load(manifest)


def _member_manifest_paths(root: Path, root_data: dict[str, Any]) -> list[Path]:
    paths: list[Path] = []
    if isinstance(root_data.get("package"), dict):
        paths.append(root / "Cargo.toml")

    workspace = root_data.get("workspace")
    members = workspace.get("members", []) if isinstance(workspace, dict) else []
    if not isinstance(members, list):
        return paths

    for pattern in members:

View on GitHub (pinned to 7fe58b0b0f)

Solutions

  1. Verify graphify-out/.graphify_extract.json has a non-empty nodes array; re-run extraction otherwise.
  2. Inspect .graphify_detect.json for the skip list and correct detection rules or the input path.
  3. Delete stale extract/detect sidecars and re-run the full pipeline.
  4. Confirm the extraction stage actually succeeded (tokens, logs) before the build step.

Example fix

# before
/graphify ./vendor-libs
# ERROR: Graph is empty ...

# after
rm graphify-out/.graphify_extract.json graphify-out/.graphify_detect.json
/graphify ./src
Defensive patterns

Strategy: validation

Validate before calling

import json
from pathlib import Path

extract = json.loads(Path('graphify-out/.graphify_extract.json').read_text(encoding='utf-8'))
if not (extract.get('nodes') or []):
    raise SystemExit('0 nodes extracted - fix corpus/skip rules before build')

Prevention

When it happens

Trigger: G.number_of_nodes() == 0 right after build: the extraction JSON's nodes list is empty because all files were skipped, the corpus is binary-only, or extraction failed upstream while still writing sidecars.

Common situations: Running the devin workflow on a docs/asset folder with no code; over-broad skip rules; extraction API silently degraded; stale empty .graphify_extract.json left from a failed run.

Related errors


AI-assisted analysis of Graphify-Labs/graphify@7fe58b0b0f (2026-08-14). Data as JSON: /api/errors/ebc1eaf56d12f984. Report an issue: GitHub.