langchain-ai/langgraph · error · ValueError
Configuration file is not under the build context . Please…
Error message
Configuration file {config_path} is not under the build context {build_context}. Please run the command from a directory that contains your langgraph.json file, What it means
_calculate_relative_workdir resolves the config file's directory and the build context and calls relative_to() between them; if the langgraph.json directory is outside the build context the Docker build could never copy it, so a ValueError instructing the user to run from a directory containing the config is raised.
Solutions
- Run the CLI command from within the build-context directory that contains langgraph.json.
- Adjust the --dockerfile/--build-context arguments so the config directory is inside the build context.
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at libs/cli/langgraph_cli/config.py:1612 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/9dcd156360ddb66e.
Report an issue: GitHub.
Appendix: source
Thrown at libs/cli/langgraph_cli/config.py:1612
full_tag = f"{api_version}-{language}{version_distro_tag}"
elif "/langgraph-server" in base_image and version_distro_tag not in base_image:
return f"{base_image}-{language}{version_distro_tag}"
else:
full_tag = version_distro_tag
return f"{base_image}:{full_tag}"
def _calculate_relative_workdir(config_path: pathlib.Path, build_context: str) -> str:
"""Calculate the relative path from build context to langgraph.json directory."""
config_dir = config_path.parent.resolve()
build_context_path = pathlib.Path(build_context).resolve()
try:
relative_path = config_dir.relative_to(build_context_path)
return str(relative_path) if str(relative_path) != "." else ""
except ValueError as _:
raise ValueError(
f"Configuration file {config_path} is not under the build context {build_context}. "
f"Please run the command from a directory that contains your langgraph.json file, "
) from None
def config_to_docker(
config_path: pathlib.Path,
config: Config,
*,
base_image: str | None = None,
api_version: str | None = None,
install_command: str | None = None,
build_command: str | None = None,
build_context: str | None = None,
escape_variables: bool = False,
) -> tuple[str, dict[str, str]]:
base_image = base_image or default_base_image(config)
View on GitHub (pinned to 38031739e5)