langchain-ai/langgraph · error · ValueError

Graph '{graph_id}' must contain a 'path' key if it is a dict

Error message

Graph '{graph_id}' must contain a 'path' key if it is a dictionary.

What it means

Error "Graph '{graph_id}' must contain a 'path' key if it is a dictionary." thrown in langchain-ai/langgraph.

Source

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

        raise click.UsageError(
            f"{label.capitalize()} '{import_str}' resolves to {resolved}, which is "
            f"not inside the target package '{plan.target.name}' or any of its "
            f"workspace dependencies. Only these directories are copied into the "
            f"container: {copied_dirs}. If this file lives in another workspace "
            f"package, add it as a dependency of '{plan.target.name}' with "
            "`{ workspace = true }` in [tool.uv.sources]."
        )

    return f"{container_path.as_posix()}:{attr_str}"


def _update_uv_lock_graph_paths(
    config_path: pathlib.Path, config: Config, plan: UvLockPlan
) -> None:
    for graph_id, data in config["graphs"].items():
        if isinstance(data, dict):
            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."

View on GitHub (pinned to 38031739e5)

When it happens

Trigger: Thrown at libs/cli/langgraph_cli/uv_lock.py:785 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/fdfc24856ce3df9c. Report an issue: GitHub.