{"record":{"id":"8285d480b7793d4b","repo":"langchain-ai/deepagents","slug":"enabled-must-be-bool-or-none-got-type-enabled","errorCode":null,"errorMessage":"`enabled` must be bool or None, got {type(enabled).__name__}","messagePattern":"`enabled` must be bool or None, got (.+?)","errorType":"exception","errorClass":"TypeError","httpStatus":null,"severity":"error","filePath":"libs/deepagents/deepagents/profiles/harness/harness_profiles.py","lineNumber":181,"sourceCode":"                `system_prompt` keys.\n\n        Returns:\n            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.","sourceCodeStart":163,"sourceCodeEnd":199,"githubUrl":"https://github.com/langchain-ai/deepagents/blob/a1af029e6e73cb17c36bff823d227747b28e91e1/libs/deepagents/deepagents/profiles/harness/harness_profiles.py#L163-L199","documentation":"from_dict type-checks each value: `enabled` must be a bool or None. Any other type (str, int, etc.) raises TypeError to fail fast on malformed config rather than coerce implicitly.","triggerScenarios":"Passing {'enabled': 'true'} or {'enabled': 1} to GeneralPurposeSubagentProfile.from_dict; YAML configs that parse on/off ambiguously are usually fine but quoted \"yes\"/'true' strings are not.","commonSituations":"Quoted booleans in YAML/JSON ('enabled: \"true\"'); 0/1 flags from environment parsing; programmatic dicts built from CLI string args.","solutions":["Convert to a real bool: {'enabled': True}.","Parse the string in the caller: enabled=val.lower() == 'true' for 'true'/'false'.","Ensure YAML/JSON unquotes boolean literals (enabled: true)."],"exampleFix":"// before\nfrom_dict({\"enabled\": \"true\"})\n// after\nfrom_dict({\"enabled\": True})","handlingStrategy":"type-guard","validationCode":"if not (enabled is None or isinstance(enabled, bool)):\n    raise TypeError(\"enabled must be bool or None\")","typeGuard":"def is_bool_or_none(v: object) -> bool:\n    return v is None or isinstance(v, bool)","tryCatchPattern":"try:\n    profile = GeneralPurposeSubagentProfile.from_dict(data)\nexcept TypeError as e:\n    logging.error(\"bad 'enabled' value: %s\", e)","preventionTips":["Unquote booleans in YAML/JSON (true not \"true\")","Coerce CLI/env string flags with val.lower() == 'true'"],"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"}