microsoft/qlib · error · ValueError
{self.storage_name}: {self.provider_uri} does not contain da
Error message
{self.storage_name}: {self.provider_uri} does not contain data for {self.freq} What it means
Raised by FileStorageMixin.uri (qlib/data/storage/file_storage.py) when the requested frequency is not among the frequencies discovered on disk (support_freq). For a single-path provider, support_freq is derived from calendar .txt files under calendars/; for a multi-path provider, from the provider_uri dict keys. Accessing data at a freq that was never dumped therefore fails with this ValueError.
Source
Thrown at qlib/data/storage/file_storage.py:62
def support_freq(self) -> List[str]:
_v = "_support_freq"
if hasattr(self, _v):
return getattr(self, _v)
if len(self.provider_uri) == 1 and C.DEFAULT_FREQ in self.provider_uri:
freq_l = filter(
lambda _freq: not _freq.endswith("_future"),
map(lambda x: x.stem, self.dpm.get_data_uri(C.DEFAULT_FREQ).joinpath("calendars").glob("*.txt")),
)
else:
freq_l = self.provider_uri.keys()
freq_l = [Freq(freq) for freq in freq_l]
setattr(self, _v, freq_l)
return freq_l
@property
def uri(self) -> Path:
if self.freq not in self.support_freq:
raise ValueError(f"{self.storage_name}: {self.provider_uri} does not contain data for {self.freq}")
return self.dpm.get_data_uri(self.freq).joinpath(f"{self.storage_name}s", self.file_name)
def check(self):
"""check self.uri
Raises
-------
ValueError
"""
if not self.uri.exists():
raise ValueError(f"{self.storage_name} not exists: {self.uri}")
class FileCalendarStorage(FileStorageMixin, CalendarStorage):
def __init__(self, freq: str, future: bool, provider_uri: dict = None, **kwargs):
super(FileCalendarStorage, self).__init__(freq, future, **kwargs)
self.future = future
self._provider_uri = None if provider_uri is None else C.DataPathManager.format_provider_uri(provider_uri)View on GitHub (pinned to 79633dd950)
Solutions
- Check what exists on disk: ls <provider_uri>/calendars/ — the .txt stems (minus _future) are the supported freqs; request one of those.
- Dump or download the data for the missing freq (qlib's dump scripts or get_data methods for the dataset you use).
- Fix the freq string: qlib canonical names are like 'day', '1min'; remove whitespace and verify against the calendar filenames.
- For multi-freq provider_uri dicts, ensure the key matches the freq you request exactly.
Example fix
# before provider_uri = "~/.qlib/qlib_data/cn_data" # only has calendars/day.txt D.features(["SH600000"], ["$close"], freq="1min") # ValueError # after D.features(["SH600000"], ["$close"], freq="day") # or dump 1min data first
Defensive patterns
Strategy: validation
Validate before calling
from pathlib import Path
supported = {p.stem.split(".")[0].removesuffix("_future") for p in (Path(provider_uri) / "calendars").glob("*.txt")}
if freq not in supported:
raise ValueError(f"freq {freq} not on disk; available: {sorted(supported)}") Type guard
def freq_available(provider_uri: str, freq: str) -> bool:
return (Path(provider_uri) / "calendars" / f"{freq}.txt").exists() Try / catch
try:
D.features(insts, fields, start, end, freq=freq)
except ValueError as e:
if "does not contain data" in str(e):
raise SystemExit(f"missing data for {freq}; dump it or use an available freq") from e
raise Prevention
- Run a startup check that provider_uri/calendars covers every freq in your config.
- Standardize freq strings from a constants module to avoid spelling drift.
When it happens
Trigger: Requesting freq="1min" when only a day-level calendar exists (calendars/day.txt); passing a freq key not present in the provider_uri mapping; misspelled freq strings ("day " vs "day", "daily" vs "day"); using remote/mounted data where some freq folders are absent.
Common situations: Switching a workflow from daily to minute data without dumping/downloading minute bins and calendars; provider_uri configured for multiple freqs but the data directory for one freq missing; trailing-whitespace or case mistakes in freq strings in configs.
Related errors
- {freq} is not supported in NumpyQuote
- I forget why would this case appear. But I think it does not
- stock selector must be type str|list, or slice(None), rather
- {self.storage_name} not exists: {self.uri}
- can't find a freq from {self.support_freq} that can resample
AI-assisted analysis of microsoft/qlib@79633dd950 (2026-08-15).
Data as JSON: /api/errors/0080ecebaa52acf6.
Report an issue: GitHub.