{"record":{"id":"c603fcc5395eb002","repo":"microsoft/qlib","slug":"provider-uri-does-not-support-type-provider-uri","errorCode":null,"errorMessage":"provider_uri does not support {type(provider_uri)}","messagePattern":"provider_uri does not support (.+?)","errorType":"exception","errorClass":"TypeError","httpStatus":null,"severity":"error","filePath":"qlib/config.py","lineNumber":369,"sourceCode":"\n        def __init__(self, provider_uri: Union[str, Path, dict], mount_path: Union[str, Path, dict]):\n            \"\"\"\n            The relation of `provider_uri` and `mount_path`\n            - `mount_path` is used only if provider_uri is an NFS path\n            - otherwise, provider_uri will be used for accessing data\n            \"\"\"\n            self.provider_uri = provider_uri\n            self.mount_path = mount_path\n\n        @staticmethod\n        def format_provider_uri(provider_uri: Union[str, dict, Path]) -> dict:\n            if provider_uri is None:\n                raise ValueError(\"provider_uri cannot be None\")\n            if isinstance(provider_uri, (str, dict, Path)):\n                if not isinstance(provider_uri, dict):\n                    provider_uri = {QlibConfig.DEFAULT_FREQ: provider_uri}\n            else:\n                raise TypeError(f\"provider_uri does not support {type(provider_uri)}\")\n            for freq, _uri in provider_uri.items():\n                if QlibConfig.DataPathManager.get_uri_type(_uri) == QlibConfig.LOCAL_URI:\n                    provider_uri[freq] = str(Path(_uri).expanduser().resolve())\n            return provider_uri\n\n        @staticmethod\n        def get_uri_type(uri: Union[str, Path]):\n            uri = uri if isinstance(uri, str) else str(uri.expanduser().resolve())\n            is_win = re.match(\"^[a-zA-Z]:.*\", uri) is not None  # such as 'C:\\\\data', 'D:'\n            # such as 'host:/data/'   (User may define short hostname by themselves or use localhost)\n            is_nfs_or_win = re.match(\"^[^/]+:.+\", uri) is not None\n\n            if is_nfs_or_win and not is_win:\n                return QlibConfig.NFS_URI\n            else:\n                return QlibConfig.LOCAL_URI\n\n        def get_data_uri(self, freq: Optional[Union[str, Freq]] = None) -> Path:","sourceCodeStart":351,"sourceCodeEnd":387,"githubUrl":"https://github.com/microsoft/qlib/blob/79633dd9506ea689e5400dea0197717b5b3d74b7/qlib/config.py#L351-L387","documentation":"The same format_provider_uri normalizer in qlib/config.py only accepts str, pathlib.Path, or a dict mapping frequency to uri/path. Any other Python type (int, list, tuple, None-like objects other than None itself) raises TypeError, telling you exactly which type was rejected.","triggerScenarios":"Passing provider_uri as a list of paths, an int/enum, or an object returned by a config loader (e.g. a ruamel/scalar tagged object) to qlib.init; also passing a dict whose values are not str/Path.","commonSituations":"YAML configs where provider_uri is written as a YAML list or the value is quoted incorrectly so it parses as a non-string scalar; programmatic configs that pass os.environ-like objects or dataclasses.","solutions":["Pass provider_uri as a string path, a pathlib.Path, or a dict {'freq': 'path'}.","In YAML, write provider_uri as a plain quoted string: provider_uri: ~/.qlib/qlib_data/cn_data.","Coerce unknown objects before init: provider_uri = str(provider_uri) when it came from a dynamic config source."],"exampleFix":"# before\nqlib.init(provider_uri=['~/.qlib/day', '~/.qlib/min'])  # list -> TypeError\n# after\nqlib.init(provider_uri={'day': '~/.qlib/day', '1min': '~/.qlib/min'})  # dict is supported","handlingStrategy":"type-guard","validationCode":"from pathlib import Path\nassert isinstance(provider_uri, (str, Path, dict)), f'provider_uri must be str/Path/dict, got {type(provider_uri)}'","typeGuard":"from pathlib import Path\n\ndef is_supported_uri_type(u) -> bool:\n    return isinstance(u, (str, Path, dict))","tryCatchPattern":null,"preventionTips":["Keep provider_uri a quoted string in YAML to avoid odd parsed types.","Coerce dynamic config values with str(...) before qlib.init."],"tags":["qlib","config","type-error","provider-uri"],"backgroundTag":null,"analyzedSha":"79633dd9506ea689e5400dea0197717b5b3d74b7","analyzedAt":"2026-08-15T07:01:27.511Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}