microsoft/qlib · error · ValueError
lib {} not in arctic
Error message
lib {} not in arctic What it means
The RemoteArcticProvider feature loader (qlib/contrib/data/data.py) reads data from an Arctic (MongoDB-backed) timeseries store, keyed by libraries named after frequency ('day', '1min', ...). If the Arctic instance has no library matching the requested freq, it raises ValueError('lib {} not in arctic'). The check is deliberately early so a missing dataset fails before symbol lookup.
Source
Thrown at qlib/contrib/data/data.py:39
self, uri="127.0.0.1", retry_time=0, market_transaction_time_list=[("09:15", "11:30"), ("13:00", "15:00")]
):
super().__init__()
self.uri = uri
# TODO:
# retry connecting if error occurs
# does it real matters?
self.retry_time = retry_time
# NOTE: this is especially important for TResample operator
self.market_transaction_time_list = market_transaction_time_list
def feature(self, instrument, field, start_index, end_index, freq):
field = str(field)[1:]
with pymongo.MongoClient(self.uri) as client:
# TODO: this will result in frequently connecting the server and performance issue
arctic = Arctic(client)
if freq not in arctic.list_libraries():
raise ValueError("lib {} not in arctic".format(freq))
if instrument not in arctic[freq].list_symbols():
# instruments does not exist
return pd.Series()
else:
df = arctic[freq].read(instrument, columns=[field], chunk_range=(start_index, end_index))
s = df[field]
if not s.empty:
s = pd.concat(
[
s.between_time(time_tuple[0], time_tuple[1])
for time_tuple in self.market_transaction_time_list
]
)
return s
View on GitHub (pinned to 79633dd950)
Solutions
- Verify what exists: arctic.list_libraries() against the same MongoDB URI, and request only those frequencies.
- Create/populate the missing library with your data ingestion pipeline (initialize the Arctic lib for that freq and write instrument data).
- Point provider_uri at the correct Mongo host/database where the library actually lives.
- Catch the ValueError at startup and degrade to an available frequency rather than crashing mid-run.
Example fix
# before D.features(instruments, fields, freq='1min') # ValueError if '1min' lib absent # after from arctic import Arctic libs = Arctic(self.uri).list_libraries() freq = '1min' if '1min' in libs else 'day' D.features(instruments, fields, freq=freq)
Defensive patterns
Strategy: validation
Validate before calling
from arctic import Arctic
from pymongo import MongoClient
with MongoClient(uri) as mc:
libs = Arctic(mc).list_libraries()
if freq not in libs:
raise ValueError(f'freq {freq} not in arctic; available: {libs}') Try / catch
try:
feats = D.features(insts, fields, freq=freq)
except ValueError as e:
if 'not in arctic' in str(e):
feats = D.features(insts, fields, freq='day') # degrade to available freq
else:
raise Prevention
- Check list_libraries() at provider startup and restrict requested frequencies to it.
- Run data ingestion for every frequency you plan to query before starting backtests.
- Monitor for Mongo migrations/renames that drop Arctic libraries.
When it happens
Trigger: Configuring qlib with an arctic provider_uri ('arctic_host:port/lib') and requesting a frequency whose library was never created — e.g. requesting 1min data when only the 'day' library was ever initialized on the Arctic/MongoDB server.
Common situations: Production MongoDB migrations that rename or drop Arctic libraries; using a fresh Mongo instance without running the data-dump scripts; requesting 'tick'/'1min' freq against a day-only store.
Related errors
- Invalid mount path
- Unknown mount error: {error_output.strip()}
- Failed to create directory {mount_path}, please create {moun
- nfs-common is not found, please install it by execute: sudo
- Mount failed: requires sudo or permission denied
AI-assisted analysis of microsoft/qlib@79633dd950 (2026-08-15).
Data as JSON: /api/errors/88b0a62b773d751c.
Report an issue: GitHub.