{"record":{"id":"0504511ce2280c1c","repo":"langchain-ai/deepagents","slug":"description-must-be-str-or-none-got-type-descr","errorCode":null,"errorMessage":"`description` must be str or None, got {type(description).__name__}","messagePattern":"`description` must be str or None, got (.+?)","errorType":"exception","errorClass":"TypeError","httpStatus":null,"severity":"error","filePath":"libs/deepagents/deepagents/profiles/harness/harness_profiles.py","lineNumber":184,"sourceCode":"            A new `GeneralPurposeSubagentProfile`.\n\n        Raises:\n            TypeError: If `data` contains unknown keys, or if any value has\n                the wrong type.\n        \"\"\"\n        unknown = set(data.keys()) - _GENERAL_PURPOSE_SUBAGENT_KEYS\n        if unknown:\n            msg = f\"Unknown keys in GeneralPurposeSubagentProfile dict: {sorted(unknown)}\"\n            raise TypeError(msg)\n        enabled = data.get(\"enabled\")\n        description = data.get(\"description\")\n        system_prompt = data.get(\"system_prompt\")\n        if enabled is not None and not isinstance(enabled, bool):\n            msg = f\"`enabled` must be bool or None, got {type(enabled).__name__}\"\n            raise TypeError(msg)\n        if description is not None and not isinstance(description, str):\n            msg = f\"`description` must be str or None, got {type(description).__name__}\"\n            raise TypeError(msg)\n        if system_prompt is not None and not isinstance(system_prompt, str):\n            msg = f\"`system_prompt` must be str or None, got {type(system_prompt).__name__}\"\n            raise TypeError(msg)\n        return cls(enabled=enabled, description=description, system_prompt=system_prompt)\n\n\n@dataclass(frozen=True)\nclass HarnessProfileConfig:\n    \"\"\"Declarative harness-profile config for YAML/JSON-backed profiles.\n\n    !!! beta\n\n        `deepagents.profiles` exposes beta APIs that may receive minor changes in\n        future releases. Refer to the [versioning documentation](https://docs.langchain.com/oss/python/versioning)\n        for more details.\n\n    A `HarnessProfileConfig` contains the file-friendly subset of harness\n    settings: plain strings, bools, lists, and nested dicts that can be loaded","sourceCodeStart":166,"sourceCodeEnd":202,"githubUrl":"https://github.com/langchain-ai/deepagents/blob/a1af029e6e73cb17c36bff823d227747b28e91e1/libs/deepagents/deepagents/profiles/harness/harness_profiles.py#L166-L202","documentation":"from_dict requires `description` to be a str or None. Non-string values (numbers, lists, dicts, bools) raise TypeError so the profile dataclass never holds an invalid description.","triggerScenarios":"Passing {'description': 123}, {'description': ['a','b']}, or a nested mapping as the description in the general-purpose subagent dict.","commonSituations":"Config where a numeric ID or list of lines was put in the description field; tooling that emits structured metadata where a plain string is expected.","solutions":["Convert to str: description=str(value) if intentional.","Join list lines: '\\n'.join(lines).","Move structured metadata to a different config section."],"exampleFix":"// before\nfrom_dict({\"description\": [\"line1\", \"line2\"]})\n// after\nfrom_dict({\"description\": \"line1\\nline2\"})","handlingStrategy":"type-guard","validationCode":"if not (description is None or isinstance(description, str)):\n    raise TypeError(\"description must be str or None\")","typeGuard":"def is_str_or_none(v: object) -> bool:\n    return v is None or isinstance(v, str)","tryCatchPattern":"try:\n    profile = GeneralPurposeSubagentProfile.from_dict(data)\nexcept TypeError as e:\n    logging.error(\"bad 'description' value: %s\", e)","preventionTips":["Keep description fields scalar text in configs","Cast or stringify numbers/lists before passing them in"],"tags":["python","profiles","type-error"],"backgroundTag":"schema-validation-failed","analyzedSha":"a1af029e6e73cb17c36bff823d227747b28e91e1","analyzedAt":"2026-08-29T11:43:24.718Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}