microsoft/qlib · error · RecorderInitializationError
Please don't reinitialize Qlib if QlibRecorder is already ac
Error message
Please don't reinitialize Qlib if QlibRecorder is already activated. Otherwise, the experiment stored location will be modified.
What it means
Error "Please don't reinitialize Qlib if QlibRecorder is already activated. Otherwise, the experiment stored location will be modified." thrown in microsoft/qlib.
Source
Thrown at qlib/workflow/__init__.py:665
Parameters
----------
keyword argument:
name1=value1, name2=value2, ...
"""
self.get_exp(start=True).get_recorder(start=True).set_tags(**kwargs)
class RecorderWrapper(Wrapper):
"""
Wrapper class for QlibRecorder, which detects whether users reinitialize qlib when already starting an experiment.
"""
def register(self, provider):
if self._provider is not None:
expm = getattr(self._provider, "exp_manager")
if expm.active_experiment is not None:
raise RecorderInitializationError(
"Please don't reinitialize Qlib if QlibRecorder is already activated. Otherwise, the experiment stored location will be modified."
)
self._provider = provider
import sys
if sys.version_info >= (3, 9):
from typing import Annotated
QlibRecorderWrapper = Annotated[QlibRecorder, RecorderWrapper]
else:
QlibRecorderWrapper = QlibRecorder
# global record
R: QlibRecorderWrapper = RecorderWrapper()
View on GitHub (pinned to 79633dd950)
Solutions
- Do not call qlib.init() again after a QlibRecorder has been activated.
- Restart your process and initialize qlib only once before starting the recorder.
When it happens
Trigger: This error is raised at qlib/workflow/__init__.py:665 when the guard condition fails: "don't reinitialize Qlib if QlibRecorder is already activated". 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/5bd6086bda4c6ed4.
Report an issue: GitHub.