langchain-ai/deepagents · error · RequestError
-32601
-32601
Error message
Method not found: session/load
What it means
`ModelSpec.parse` requires the `provider:model` format and raises `ValueError` when the input has no colon at all. The library uses this strict format everywhere a model is addressed, so a bare model name like `claude-sonnet-4-5` is rejected with a message showing the expected shape.
Source
Thrown at libs/acp/deepagents_acp/server.py:405
# Return response with both modes (for backward compatibility) and config_options
return NewSessionResponse(
session_id=session_id,
modes=self._modes if self._modes is not None else None,
config_options=config_options,
)
async def load_session(
self,
cwd: str,
session_id: str,
additional_directories: list[str] | None = None, # noqa: ARG002 # capability is not advertised
mcp_servers: list[McpServer] | None = None,
**kwargs: Any, # noqa: ARG002 # ACP protocol interface parameter
) -> LoadSessionResponse:
"""Restore and replay a persisted ACP session."""
if not self._load_sessions:
method = "session/load"
raise RequestError.method_not_found(method)
self._session_cwds[session_id] = cwd
agent = self._checkpointed_agent(session_id)
metadata = (await agent.aget_state(self._session_config(session_id))).metadata or {}
if metadata.get(_ACP_SESSION_METADATA_KEY) is not True:
self._forget_session(session_id)
raise RequestError.resource_not_found(session_id)
if metadata.get("cwd") != cwd:
self._forget_session(session_id)
raise RequestError.invalid_params(
{"cwd": "must match the working directory used to create the session"}
)
self._session_mcp_servers[session_id] = list(mcp_servers or [])
self._initialize_session_options(session_id)
if self._restore_session_options(session_id, metadata):
self._reset_agent(session_id)
View on GitHub (pinned to a1af029e6e)
Solutions
- Prefix the provider: `anthropic:claude-sonnet-4-5`
- If you must accept bare names, resolve them to a spec yourself (e.g. via provider detection) before parsing
- Use `ModelSpec.try_parse(...)` to validate first
Example fix
// before
spec = ModelSpec.parse("claude-sonnet-4-5")
// after
spec = ModelSpec.parse("anthropic:claude-sonnet-4-5") Defensive patterns
Strategy: try-catch
Validate before calling
def is_parseable_spec(raw: str) -> bool:
return ModelSpec.try_parse(raw) is not None
if not is_parseable_spec(raw):
raise ValueError(f"{raw!r} must be 'provider:model'") Type guard
def is_model_spec_string(value: object) -> bool:
return (
isinstance(value, str)
and ":" in value
and bool(value.split(":", 1)[0])
and bool(value.split(":", 1)[1])
) Try / catch
try:
spec = ModelSpec.parse(raw)
except ValueError:
detected = detect_provider(raw) # resolve bare model names if supported
spec = ModelSpec.parse(f"{detected}:{raw}") if detected else DEFAULT_MODEL_SPEC Prevention
- Never write bare model names where a spec is expected — always include `provider:`
- Copy the exact example format from the error message
- Use `try_parse` in interactive/CLI input handling to give friendly feedback
When it happens
Trigger: `ModelSpec.parse("claude-sonnet-4-5")` or any string without `:`; called indirectly via `parse`/`try_parse` from `_get_default_model_spec`, `_sdk_version_from_source`, or when an allowlist entry reaches spec parsing.
Common situations: Writing just the model name in `config.toml` (`model = "claude-sonnet-4-5"`) where a spec is expected; assuming auto-detection applies — only some paths (via `detect_provider`) accept bare model names; older configs written before the provider prefix became mandatory.
Related errors
- modes can only be provided when agent is a factory
- models can only be provided when agent is a factory
- -32002
- -32602
- recursion_limit must be None or a positive integer
AI-assisted analysis of langchain-ai/deepagents@a1af029e6e (2026-08-29).
Data as JSON: /api/errors/a2d72974812d99dc.
Report an issue: GitHub.