langchain-ai/langgraph · error · ValueError

Graph ' ' must be a string or a dictionary with a 'path'…

Error message

Graph '{graph_id}' must be a string or a dictionary with a 'path' key.

What it means

Raised when a graph entry in the config is neither a plain string import path nor a dictionary containing a 'path' key. The config schema for 'graphs' accepts only these two shapes, so any other type (number, list, dict without 'path') makes the config invalid. Correct the graphs entry type.

Solutions

  1. Make the graphs.<id> entry a string import path or a dict containing a 'path' key.
  2. Check for malformed JSON/YAML values in langgraph.json.
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at libs/cli/langgraph_cli/uv_lock.py:802 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of langchain-ai/langgraph@38031739e5 (2026-08-26). Data as JSON: /api/errors/a7e7be446fbe48d0. Report an issue: GitHub.

Appendix: source

Thrown at libs/cli/langgraph_cli/uv_lock.py:802

            if "path" not in data:
                raise ValueError(
                    f"Graph '{graph_id}' must contain a 'path' key if it is a dictionary."
                )
            config["graphs"][graph_id]["path"] = _rewrite_uv_lock_import_path(
                config_path,
                data["path"],
                plan,
                label=f"graph '{graph_id}'",
            )
        elif isinstance(data, str):
            config["graphs"][graph_id] = _rewrite_uv_lock_import_path(
                config_path,
                data,
                plan,
                label=f"graph '{graph_id}'",
            )
        else:
            raise ValueError(
                f"Graph '{graph_id}' must be a string or a dictionary with a 'path' key."
            )


def _update_uv_lock_component_path(
    config_path: pathlib.Path,
    config: Config,
    plan: UvLockPlan,
    *,
    section: str,
    key: str,
    label: str,
) -> None:
    section_config = config.get(section)
    if not isinstance(section_config, dict):
        return

    path_str = section_config.get(key)

View on GitHub (pinned to 38031739e5)