{"record":{"id":"f3aa6f433f55c38d","repo":"assafelovic/gpt-researcher","slug":"unsupported-type-type-hint-for-key-key","errorCode":null,"errorMessage":"Unsupported type {type_hint} for key {key}","messagePattern":"Unsupported type (.+?) for key (.+?)","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"gpt_researcher/config/config.py","lineNumber":306,"sourceCode":"            # Env values are often hand-edited (trailing commas, single quotes).\n            # Bare `list` has get_origin(None); typing.List[...] has origin list.\n            try:\n                value = json_repair.loads(env_value)\n            except Exception as exc:\n                raise ValueError(f\"Cannot convert {env_value} to list\") from exc\n            if not isinstance(value, list):\n                raise ValueError(f\"Cannot convert {env_value} to list\")\n            return value\n        elif type_hint is dict:\n            try:\n                value = json_repair.loads(env_value)\n            except Exception as exc:\n                raise ValueError(f\"Cannot convert {env_value} to dict\") from exc\n            if not isinstance(value, dict):\n                raise ValueError(f\"Cannot convert {env_value} to dict\")\n            return value\n        else:\n            raise ValueError(f\"Unsupported type {type_hint} for key {key}\")\n\n\n    def set_verbose(self, verbose: bool) -> None:\n        \"\"\"Set the verbosity level.\"\"\"\n        self.llm_kwargs[\"verbose\"] = verbose\n\n    def get_mcp_server_config(self, name: str) -> dict:\n        \"\"\"\n        Get the configuration for an MCP server.\n        \n        Args:\n            name (str): The name of the MCP server to get the config for.\n                \n        Returns:\n            dict: The server configuration, or an empty dict if the server is not found.\n        \"\"\"\n        if not name or not self.mcp_servers:\n            return {}","sourceCodeStart":288,"sourceCodeEnd":324,"githubUrl":"https://github.com/assafelovic/gpt-researcher/blob/6f998577d547b1e54ec662dac63583aa11e3b84b/gpt_researcher/config/config.py#L288-L324","documentation":"convert_env_value handles bool, int, float, str, list, dict and None; any other type hint (or a value that doesn't fit the str branch) falls to the final else and raises 'Unsupported type ... for key ...'.","triggerScenarios":"A Config attribute annotated with an exotic type (set, custom class, tuple) whose matching env var is set, so conversion is attempted; typically surfaces after library changes introduce new annotations.","commonSituations":"Version drift: your fork adds a typed attribute without updating convert_env_value; passing nested typed structures via env.","solutions":["Change the attribute's annotation to a supported type (str/int/float/bool/list/dict)","Set the value programmatically instead of via env var","Report/patch convert_env_value to support the type"],"exampleFix":"# before\nmy_field: set[str]  # env conversion raises\n# after\nmy_field: list[str]","handlingStrategy":"validation","validationCode":"SUPPORTED = (bool, int, float, str, list, dict, type(None))\n# when subclassing/patching Config, check annotations:\nfor k, t in Config.__annotations__.items():\n    assert t in SUPPORTED or str(t).startswith('typing'), f\"unsupported {k}: {t}\"","typeGuard":null,"tryCatchPattern":"try:\n    cfg = Config()\nexcept ValueError as e:\n    if \"Unsupported type\" in str(e):\n        # set programmatically instead of env\n        cfg = Config(); setattr(cfg, key, value)\n    else: raise","preventionTips":["Annotate custom Config fields with supported primitives","Set exotic values in code, not env"],"tags":["python","config","type-coercion","internal"],"backgroundTag":"unsupported-config-type","analyzedSha":"6f998577d547b1e54ec662dac63583aa11e3b84b","analyzedAt":"2026-08-28T17:50:07.383Z","schemaVersion":2},"datasetVersion":"2026-08-28T21:17:43.275Z"}