{"record":{"id":"7fb575676bfbca04","repo":"microsoft/qlib","slug":"self-storage-name-not-exists-self-uri","errorCode":null,"errorMessage":"{self.storage_name} not exists: {self.uri}","messagePattern":"(.+?) not exists: (.+?)","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"qlib/data/storage/file_storage.py","lineNumber":73,"sourceCode":"        freq_l = [Freq(freq) for freq in freq_l]\n        setattr(self, _v, freq_l)\n        return freq_l\n\n    @property\n    def uri(self) -> Path:\n        if self.freq not in self.support_freq:\n            raise ValueError(f\"{self.storage_name}: {self.provider_uri} does not contain data for {self.freq}\")\n        return self.dpm.get_data_uri(self.freq).joinpath(f\"{self.storage_name}s\", self.file_name)\n\n    def check(self):\n        \"\"\"check self.uri\n\n        Raises\n        -------\n        ValueError\n        \"\"\"\n        if not self.uri.exists():\n            raise ValueError(f\"{self.storage_name} not exists: {self.uri}\")\n\n\nclass FileCalendarStorage(FileStorageMixin, CalendarStorage):\n    def __init__(self, freq: str, future: bool, provider_uri: dict = None, **kwargs):\n        super(FileCalendarStorage, self).__init__(freq, future, **kwargs)\n        self.future = future\n        self._provider_uri = None if provider_uri is None else C.DataPathManager.format_provider_uri(provider_uri)\n        self.enable_read_cache = True  # TODO: make it configurable\n        self.region = C[\"region\"]\n\n    @property\n    def file_name(self) -> str:\n        return f\"{self._freq_file}_future.txt\" if self.future else f\"{self._freq_file}.txt\".lower()\n\n    @property\n    def _freq_file(self) -> str:\n        \"\"\"the freq to read from file\"\"\"\n        if not hasattr(self, \"_freq_file_cache\"):","sourceCodeStart":55,"sourceCodeEnd":91,"githubUrl":"https://github.com/microsoft/qlib/blob/79633dd9506ea689e5400dea0197717b5b3d74b7/qlib/data/storage/file_storage.py#L55-L91","documentation":"Raised by FileStorageMixin.check (qlib/data/storage/file_storage.py) when the computed uri (provider data path + storage folder + file name) does not exist on the filesystem. After the freq was validated, the specific storage artifact (calendar, instruments, or features file) itself is missing. It signals an incomplete or misnamed data directory rather than a wrong API call.","triggerScenarios":"provider_uri points at an empty or partially-populated directory (calendars exist but instruments/ or features/ missing); the file for a specific instrument is absent because data was dumped selectively; wrong region data path (cn_data vs us_data) in C.setdefault('provider_uri', ...).","commonSituations":"First-run setups where the data was never downloaded; partial dumps interrupted midway; pointing provider_uri at the wrong folder (e.g. the qlib repo instead of the data dir); instruments market files (e.g. csi300.txt) not present.","solutions":["Inspect the failing uri printed in the error: verify each path component exists and matches the expected layout (calendars/, instruments/, features/<inst>/<day>.bin).","Download or re-dump the qlib bin data for your region and market (qlib's get_data / dump_bin tooling).","Correct C[\"provider_uri\"] to the actual data root — the folder that directly contains calendars/.","If only some instruments are missing, restrict instruments to those dumped, or re-dump the missing ones."],"exampleFix":"# before\nimport qlib\nqlib.init(provider_uri=\"~/.qlib/qlib_data/cn_data\")  # dir empty or wrong\n\n# after\n# ensure the folder contains calendars/, instruments/, features/:\n#   ls ~/.qlib/qlib_data/cn_data -> calendars instruments features\nqlib.init(provider_uri=\"~/.qlib/qlib_data/cn_data\")","handlingStrategy":"validation","validationCode":"root = Path(provider_uri)\nfor sub in (\"calendars\", \"instruments\", \"features\"):\n    if not (root / sub).is_dir():\n        raise FileNotFoundError(f\"incomplete qlib data at {root}: missing {sub}/\")","typeGuard":"def qlib_data_complete(provider_uri: str) -> bool:\n    root = Path(provider_uri)\n    return all((root / s).is_dir() for s in (\"calendars\", \"instruments\", \"features\"))","tryCatchPattern":"try:\n    storage.check()\nexcept ValueError as e:\n    if \"not exists\" in str(e):\n        logger.error(\"qlib data incomplete: %s\", e)\n        raise SystemExit(\"re-download or re-dump qlib bin data\") from e\n    raise","preventionTips":["Verify the data root layout right after qlib.init in every entrypoint.","Pin data dump scripts and data versions together with the qlib package version."],"tags":["qlib","storage","missing-file","setup"],"backgroundTag":null,"analyzedSha":"79633dd9506ea689e5400dea0197717b5b3d74b7","analyzedAt":"2026-08-15T07:01:27.511Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}