langchain-ai/deepagents · error · TypeError
Unknown keys in GeneralPurposeSubagentProfile dict: {sorted(
Error message
Unknown keys in GeneralPurposeSubagentProfile dict: {sorted(unknown)} What it means
GeneralPurposeSubagentProfile.from_dict only accepts the fixed key set _GENERAL_PURPOSE_SUBAGENT_KEYS (enabled, description, system_prompt). Any other key in the dict raises TypeError, protecting users from silently ignored typos.
Source
Thrown at libs/deepagents/deepagents/profiles/harness/harness_profiles.py:175
@classmethod
def from_dict(cls, data: Mapping[str, Any]) -> GeneralPurposeSubagentProfile:
"""Construct a sub-profile from a plain dict.
Args:
data: Mapping with any subset of `enabled`, `description`, and
`system_prompt` keys.
Returns:
A new `GeneralPurposeSubagentProfile`.
Raises:
TypeError: If `data` contains unknown keys, or if any value has
the wrong type.
"""
unknown = set(data.keys()) - _GENERAL_PURPOSE_SUBAGENT_KEYS
if unknown:
msg = f"Unknown keys in GeneralPurposeSubagentProfile dict: {sorted(unknown)}"
raise TypeError(msg)
enabled = data.get("enabled")
description = data.get("description")
system_prompt = data.get("system_prompt")
if enabled is not None and not isinstance(enabled, bool):
msg = f"`enabled` must be bool or None, got {type(enabled).__name__}"
raise TypeError(msg)
if description is not None and not isinstance(description, str):
msg = f"`description` must be str or None, got {type(description).__name__}"
raise TypeError(msg)
if system_prompt is not None and not isinstance(system_prompt, str):
msg = f"`system_prompt` must be str or None, got {type(system_prompt).__name__}"
raise TypeError(msg)
return cls(enabled=enabled, description=description, system_prompt=system_prompt)
@dataclass(frozen=True)
class HarnessProfileConfig:
"""Declarative harness-profile config for YAML/JSON-backed profiles.View on GitHub (pinned to a1af029e6e)
Solutions
- Remove unknown keys; keep only enabled, description, system_prompt.
- Fix key spelling to snake_case ('system_prompt' not 'systemPrompt').
- Check the schema/version expected by the installed deepagents release.
Example fix
// before
from_dict({"systemPrompt": "...", "verbose": True})
// after
from_dict({"system_prompt": "..."}) Defensive patterns
Strategy: validation
Validate before calling
ALLOWED = {"enabled", "description", "system_prompt"}
unknown = set(data.keys()) - ALLOWED
if unknown:
raise ValueError(f"unexpected keys: {sorted(unknown)}") Type guard
def is_subagent_dict(v: object) -> bool:
return isinstance(v, dict) and set(v) <= {"enabled", "description", "system_prompt"} Try / catch
try:
profile = GeneralPurposeSubagentProfile.from_dict(data)
except TypeError as e:
logging.error("invalid subagent profile config: %s", e)
profile = GeneralPurposeSubagentProfile() Prevention
- Use snake_case keys matching the dataclass fields
- Validate YAML/JSON against the documented schema before loading
- Pin and read the docs for your installed deepagents version
When it happens
Trigger: Passing a dict with misspelled or extra keys, e.g. {'systemPrompt': ...}, {'prompt': ...}, or a whole unrelated config block, to from_dict via _coerce_general_purpose_subagent.
Common situations: YAML/JSON harness config with camelCase instead of snake_case; leftover keys from an older schema version; nesting a provider config under the subagent block by mistake.
Understand the failure class
Background: Schema validation failed / invalid input schema: payload rejected because its shape doesn't match the expected schema — this error's family across 28 libraries.
Related errors
- Profile key must be a non-empty string.
- Profile key {key!r} has leading or trailing whitespace; expe
- Profile key {key!r} has more than one ':'; expected 'provide
- Profile key {key!r} has an empty provider or model half; exp
- Profile key {key!r} has whitespace adjacent to ':'; expected
AI-assisted analysis of langchain-ai/deepagents@a1af029e6e (2026-08-29).
Data as JSON: /api/errors/2a7ff87bce642aea.
Report an issue: GitHub.