langchain-ai/deepagents · error · RuntimeError
Server process is not running
Error message
Server process is not running
What it means
`wait_for_graph_ready` polls the LangGraph dev server's `/assistants/{graph_name}/graph` endpoint until the graph resolves. Before polling it checks that a server subprocess handle exists; if `self._process` is None it raises this RuntimeError because there is nothing to wait for. It means readiness was requested without a server ever having been started (or after it was stopped).
Source
Thrown at libs/code/deepagents_code/client/launch/server.py:1007
graph_name: str = "agent",
*,
timeout: float = _HEALTH_TIMEOUT, # noqa: ASYNC109
) -> None:
"""Resolve the served graph once so lazy startup failures surface early.
Args:
graph_name: Registered graph name from `langgraph.json`.
timeout: Max seconds to wait for the graph readiness request.
Raises:
RuntimeError: If the server process exits or the graph endpoint
does not return a successful response.
"""
import httpx
if self._process is None:
msg = "Server process is not running"
raise RuntimeError(msg)
graph_url = f"{self.url}/assistants/{quote(graph_name, safe='')}/graph"
deadline = time.monotonic() + timeout
async with httpx.AsyncClient() as client:
while time.monotonic() < deadline:
if self._process.poll() is not None:
msg = f"Server process exited with code {self._process.returncode}"
output = self._read_log_file()
if output:
summary = _extract_startup_error_marker(output)
if summary:
msg += f": {summary}"
msg += f"\n{output[-_LOG_TAIL_CHARS:]}"
raise RuntimeError(msg)
remaining = max(0.1, deadline - time.monotonic())
try:View on GitHub (pinned to a1af029e6e)
Solutions
- Start the server first (call the launch/start API) before awaiting wait_for_graph_ready
- If the server was stopped intentionally, restart it via restart() or _respawn_server before checking readiness
- Check whether an earlier startup failure already stopped the server and handle that error instead of retrying readiness
- Ensure no code path calls stop() concurrently with wait_for_graph_ready (state is guarded by _state_lock)
Example fix
// before server = ServerProcess(...) await server.wait_for_graph_ready() # RuntimeError: process is None // after server = ServerProcess(...) await server.start() await server.wait_for_graph_ready()
Defensive patterns
Strategy: validation
Validate before calling
if server._process is None:
server = await server.start() # or restart() before polling
await server.wait_for_graph_ready() Prevention
- Always start the server through the library's launch API before awaiting readiness
- Never call stop() and wait_for_graph_ready() concurrently
- Treat a stopped server as terminal: restart, do not re-poll
When it happens
Trigger: Calling `wait_for_graph_ready` on a ServerProcess before `start_server_and_get_agent`/startup has spawned the subprocess, after `stop()`/`_stop_process()` cleared `self._process`, or after a respawn path failed to launch a new process. Callers affected: `_respawn_server`, `start_server_and_get_agent`.
Common situations: Manually invoking stop() then retrying readiness without restarting; a race where the server exited and its handle was cleared before readiness polling; custom scripts that construct a ServerProcess and call wait_for_graph_ready directly.
Related errors
- A workspace is required to start the remote agent.
- Cannot configure a closed MCP session manager
- Cannot create an MCP session after cleanup
- Agent initialization failed
- shell.allow_list is missing from the configuration manifest
AI-assisted analysis of langchain-ai/deepagents@a1af029e6e (2026-08-29).
Data as JSON: /api/errors/e58e71a8e9fe0c37.
Report an issue: GitHub.