langchain-ai/langgraph · error · ValueError

Invalid keep_pkg_tools

Error message

Invalid keep_pkg_tools: '{keep_pkg_tools}'. Must be bool or list[str] (with values 'pip', 'setuptools', and/or 'wheel').

What it means

Type-level validation of keep_pkg_tools in the CLI config validator: the value is neither a boolean nor a list — keep_pkg_tools must be true/false or a list whose entries are 'pip', 'setuptools', 'wheel'. A string like 'pip', an int, or null-like truthy scalar of another type reaches this raise after the list branch is skipped.

Solutions

  1. Use a boolean: "keep_pkg_tools": true (or false)
  2. Or a list of allowed tools: "keep_pkg_tools": ["pip", "wheel"]
  3. Remove the key entirely for default behavior
Defensive patterns

Strategy: type-guard

When it happens

Trigger: Thrown at libs/cli/langgraph_cli/config.py:555 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/445826fe9c550d57. Report an issue: GitHub.

Appendix: source

Thrown at libs/cli/langgraph_cli/config.py:555

    if http_conf := config.get("http"):
        if "app" in http_conf:
            if ":" not in http_conf["app"]:
                raise ValueError(
                    f"Invalid http.app format: '{http_conf['app']}'. "
                    "Must be in format './path/to/file.py:attribute_name'"
                )
    if keep_pkg_tools := config.get("keep_pkg_tools"):
        if isinstance(keep_pkg_tools, list):
            for tool in keep_pkg_tools:
                if tool not in _BUILD_TOOLS:
                    raise ValueError(
                        f"Invalid keep_pkg_tools: '{tool}'. "
                        "Must be one of 'pip', 'setuptools', 'wheel'."
                    )
        elif keep_pkg_tools is True:
            pass
        else:
            raise ValueError(
                f"Invalid keep_pkg_tools: '{keep_pkg_tools}'. "
                "Must be bool or list[str] (with values"
                " 'pip', 'setuptools', and/or 'wheel')."
            )
    return config


# Keys recognized by validate_config (used to detect unknown fields).
_KNOWN_CONFIG_KEYS = {
    "python_version",
    "node_version",
    "api_version",
    "base_image",
    "image_distro",
    "pip_config_file",
    "pip_installer",
    "source",
    "dependencies",

View on GitHub (pinned to 38031739e5)