langchain-ai/deepagents · error · RequestError
-32002
-32002
Error message
Resource not found: session_id
What it means
`parse_model_allowlist` validates the raw TOML value of `[models].allowed` and raises `TypeError` when the value is not a list. The allowlist must be an array of spec strings; anything else (string, table, bare value) cannot represent an allowlist.
Source
Thrown at libs/acp/deepagents_acp/server.py:412
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)
await self._replay_session(session_id, agent)
return LoadSessionResponse(
modes=self._session_mode_states.get(session_id),
config_options=self._build_config_options(session_id) or None,
)
async def set_session_mode(View on GitHub (pinned to a1af029e6e)
Solutions
- Wrap the value in a TOML array: `allowed = ["anthropic:claude-sonnet-4-5"]`
- Check the `[models]` table — ensure `allowed` is not accidentally a sub-table header
- Validate the TOML structure with a TOML linter/parser before loading
Example fix
# before [models] allowed = "anthropic:claude-sonnet-4-5" # after [models] allowed = ["anthropic:claude-sonnet-4-5"]
Defensive patterns
Strategy: type-guard
Validate before calling
allowed = data.get("models", {}).get("allowed")
if allowed is not None and not isinstance(allowed, list):
raise TypeError("[models].allowed must be a TOML array of strings") Type guard
def is_allowlist_value(value: object) -> bool:
return isinstance(value, list) and all(
isinstance(e, str) and e.strip() for e in value
) Try / catch
try:
parsed = parse_model_allowlist(raw)
except TypeError:
logger.error("[models].allowed must be an array; got %s", type(raw).__name__)
parsed = () Prevention
- Always write allowlists as TOML arrays, even for a single entry: `allowed = ["..."]`
- Avoid `[models.allowed]` table headers, which turn the key into a dict
- Lint `config.toml` structure before deploying it
When it happens
Trigger: Setting `allowed = "anthropic:claude-sonnet-4-5"` (a bare string instead of `["..."]`) or `allowed = { ... }` in `config.toml`; passing a non-list programmatically to `parse_model_allowlist`, e.g. via `coerce_toml_value`.
Common situations: Misreading the config schema and writing a single spec as a scalar instead of a one-element array; TOML table accidentally placed under `[models.allowed]` making it a dict.
Related errors
- -32602
- {name} must be a table
- context.auto_approve must be a boolean or null, got {type(au
- modes can only be provided when agent is a factory
- models can only be provided when agent is a factory
AI-assisted analysis of langchain-ai/deepagents@a1af029e6e (2026-08-29).
Data as JSON: /api/errors/ce5e3b7b2aea1383.
Report an issue: GitHub.