microsoft/qlib · error · ValueError
No data to sync to disk.
Error message
No data to sync to disk.
What it means
Error "No data to sync to disk." thrown in microsoft/qlib.
Source
Thrown at qlib/data/cache.py:815
This class is the proxy of the disk data.
"""
KEY = "df"
def __init__(self, cache_path: Union[str, Path]):
self.index_path = cache_path.with_suffix(".index")
self._data = None
self.logger = get_module_logger(self.__class__.__name__)
def get_index(self, start_time=None, end_time=None):
# TODO: fast read index from the disk.
if self._data is None:
self.sync_from_disk()
return self._data.loc[start_time:end_time].copy()
def sync_to_disk(self):
if self._data is None:
raise ValueError("No data to sync to disk.")
self._data.sort_index(inplace=True)
self._data.to_hdf(self.index_path, key=self.KEY, mode="w", format="table")
# The index should be readable for all users
self.index_path.chmod(stat.S_IRWXU | stat.S_IRGRP | stat.S_IROTH)
def sync_from_disk(self):
# The file will not be closed directly if we read_hdf from the disk directly
with pd.HDFStore(self.index_path, mode="r") as store:
if "/{}".format(self.KEY) in store.keys():
self._data = pd.read_hdf(store, key=self.KEY)
else:
self._data = pd.DataFrame()
def update(self, data, sync=True):
self._data = data.astype(np.int32).copy()
if sync:
self.sync_to_disk()
View on GitHub (pinned to 79633dd950)
Solutions
- Ensure there is data in the cache before calling sync/flush to disk.
- Check that the cache was populated (e.g. features were queried) before triggering the sync.
When it happens
Trigger: This error is raised at qlib/data/cache.py:815 when the guard condition fails: "No data to sync to disk.". It triggers when the code path receives input or a state that violates the precondition checked at this point — e.g. an unimplemented abstract method being called, an unsupported argument type/value, or an invalid configuration. To avoid it, satisfy the documented precondition before this call: implement the required method in your subclass, or pass a supported value of the expected type as described by the message.
Common situations: See trigger scenarios.
AI-assisted analysis of microsoft/qlib@79633dd950 (2026-08-15).
Data as JSON: /api/errors/97d15b7275cb5e5a.
Report an issue: GitHub.