{"record":{"id":"fb999d84e9ce0ecc","repo":"microsoft/qlib","slug":"unable-to-fetch-instruments-from-remote-server","errorCode":null,"errorMessage":"Unable to fetch instruments from remote server!","messagePattern":"Unable to fetch instruments from remote server!","errorType":"exception","errorClass":"IOError","httpStatus":null,"severity":"critical","filePath":"qlib/data/data.py","lineNumber":1137,"sourceCode":"                    \"disk_cache\": 1,\n                },\n                msg_queue=self.queue,\n            )\n            # - Done in callback\n            feature_uri = self.queue.get(timeout=C[\"timeout\"])\n            if isinstance(feature_uri, Exception):\n                raise feature_uri\n            get_module_logger(\"data\").debug(\"get result\")\n            try:\n                # pre-mound nfs, used for demo\n                mnt_feature_uri = C.dpm.get_data_uri(freq).joinpath(C.dataset_cache_dir_name, feature_uri)\n                df = DiskDatasetCache.read_data_from_cache(mnt_feature_uri, start_time, end_time, fields)\n                get_module_logger(\"data\").debug(\"finish slicing data\")\n                if return_uri:\n                    return df, feature_uri\n                return df\n            except AttributeError as attribute_e:\n                raise IOError(\"Unable to fetch instruments from remote server!\") from attribute_e\n\n\nclass BaseProvider:\n    \"\"\"Local provider class\n    It is a set of interface that allow users to access data.\n    Because PITD is not exposed publicly to users, so it is not included in the interface.\n\n    To keep compatible with old qlib provider.\n    \"\"\"\n\n    def calendar(self, start_time=None, end_time=None, freq=\"day\", future=False):\n        return Cal.calendar(start_time, end_time, freq, future=future)\n\n    def instruments(self, market=\"all\", filter_pipe=None, start_time=None, end_time=None):\n        if start_time is not None or end_time is not None:\n            get_module_logger(\"Provider\").warning(\n                \"The instruments corresponds to a stock pool. \"\n                \"Parameters `start_time` and `end_time` does not take effect now.\"","sourceCodeStart":1119,"sourceCodeEnd":1155,"githubUrl":"https://github.com/microsoft/qlib/blob/79633dd9506ea689e5400dea0197717b5b3d74b7/qlib/data/data.py#L1119-L1155","documentation":"In client/server mode, after qlib-server returns a dataset-cache URI, qlib mounts the NFS path via `C.dpm.get_data_uri(freq)/<dataset_cache_dir_name>/<uri>` and calls `DiskDatasetCache.read_data_from_cache`. If that read hits an AttributeError (cache file malformed / wrong object layout), it is re-raised as IOError('Unable to fetch instruments from remote server!'), chained from the original cause.","triggerScenarios":"`D.features(...)` in client mode where the server-generated cache exists but reading it fails — e.g. cache dir name mismatch, NFS mount missing the file, or a cache produced by an incompatible qlib version whose pickle/binary layout changed.","commonSituations":"Environments where qlib-server version and client qlib version drift; NFS not mounted at the expected point; stale caches after schema changes.","solutions":["Retry once with `D.features(..., disk_cache=0)` to bypass the cache path and confirm the data itself is fine.","Check `C.dpm.get_data_uri(freq) / C.dataset_cache_dir_name` is mounted and contains the returned URI.","Align client and server qlib versions (`pip show pyqlib` both sides) and clear the stale dataset cache dir."],"exampleFix":"# before\ndf = D.features(insts, fields, start, end)  # server + disk_cache path\n\n# after\ndf = D.features(insts, fields, start, end, disk_cache=0)","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try:\n    df = D.features(insts, fields, start, end)\nexcept IOError as e:\n    if 'Unable to fetch instruments' in str(e):\n        df = D.features(insts, fields, start, end, disk_cache=0)  # bypass server cache\n    else:\n        raise","preventionTips":["Keep a disk_cache=0 fallback path in code that talks to qlib-server.","Pin matching qlib client/server versions.","Monitor NFS mount health for the dataset cache directory."],"tags":["client-server","cache","io","network"],"backgroundTag":null,"analyzedSha":"79633dd9506ea689e5400dea0197717b5b3d74b7","analyzedAt":"2026-08-15T07:01:27.511Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}