{"record":{"id":"8ca6eab8a51aa9c2","repo":"langchain-ai/langgraph","slug":"graph-graph-id-must-contain-a-path-key-if-i","errorCode":null,"errorMessage":"Graph '{graph_id}' must contain a 'path' key if  it is a dictionary.","messagePattern":"Graph '(.+?)' must contain a 'path' key if  it is a dictionary\\.","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"libs/cli/langgraph_cli/config.py","lineNumber":870,"sourceCode":"        config_path: The path to the config file (e.g. `langgraph.json`).\n        config: The validated configuration dictionary.\n        local_deps: An object containing references to local dependencies:\n            - real Python packages (with a `pyproject.toml` or `setup.py`)\n            - “faux” packages that need minimal metadata to be installable\n            - potential `requirements.txt` for local dependencies\n            - container work directory (if \".\" is in `dependencies`)\n\n    Raises:\n        ValueError: If the import string is not in the format `<module>:<attribute>`\n                    or if the referenced local file is not found in `dependencies`.\n        FileNotFoundError: If the local file (module) does not actually exist on disk.\n        IsADirectoryError: If `module_str` points to a directory instead of a file.\n    \"\"\"\n    for graph_id, data in config[\"graphs\"].items():\n        if isinstance(data, dict):\n            # Then we're looking for a 'path' key\n            if \"path\" not in data:\n                raise ValueError(\n                    f\"Graph '{graph_id}' must contain a 'path' key if \"\n                    f\" it is a dictionary.\"\n                )\n            import_str = data[\"path\"]\n        elif isinstance(data, str):\n            import_str = data\n        else:\n            raise ValueError(\n                f\"Graph '{graph_id}' must be a string or a dictionary with a 'path' key.\"\n            )\n\n        module_str, _, attr_str = import_str.partition(\":\")\n        if not module_str or not attr_str:\n            message = (\n                'Import string \"{import_str}\" must be in format \"<module>:<attribute>\".'\n            )\n            raise ValueError(message.format(import_str=import_str))\n","sourceCodeStart":852,"sourceCodeEnd":888,"githubUrl":"https://github.com/langchain-ai/langgraph/blob/38031739e551638e373fb553453256c23feeb41f/libs/cli/langgraph_cli/config.py#L852-L888","documentation":"Graph-config validation in the CLI: an entry under the top-level 'graphs' mapping in langgraph.json is a dict but has no 'path' key. Dict-form graph entries must at minimum point at a module file via 'path' (with optional 'method' for the attribute); a dict with only 'method' or with unrelated keys triggers this raise.","triggerScenarios":"Thrown at libs/cli/langgraph_cli/config.py:870 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Add a 'path' key: \"graphs\": {\"mygraph\": {\"path\": \"./my_agent.py\", \"method\": \"graph\"}}","Or use the compact string form: \"graphs\": {\"mygraph\": \"./my_agent.py:graph\"}"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"38031739e551638e373fb553453256c23feeb41f","analyzedAt":"2026-08-26T18:02:49.312Z","contentChangedAt":"2026-08-26T18:02:49.312Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}