{"record":{"id":"dd516fb1b80ef413","repo":"microsoft/qlib","slug":"you-can-choose-only-one-of-local-path-save-the-f","errorCode":null,"errorMessage":"You can choose only one of `local_path`(save the files in a path) or `kwargs`(pass in the objects directly)","messagePattern":"You can choose only one of `local_path`\\(save the files in a path\\) or `kwargs`\\(pass in the objects directly\\)","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"qlib/workflow/__init__.py","lineNumber":531,"sourceCode":"            with R.start(experiment_name='test'):\n                R.save_objects(local_path='results/pred.pkl', artifact_path=\"prediction\")\n                rid = R.get_recorder().id\n            ...\n            R.get_recorder(recorder_id=rid).load_object(\"prediction/pred.pkl\")  #  after saving objects, you can load the previous object with this api\n\n\n        Parameters\n        ----------\n        local_path : str\n            if provided, them save the file or directory to the artifact URI.\n        artifact_path : str\n            the relative path for the artifact to be stored in the URI.\n        **kwargs: Dict[Text, Any]\n            the object to be saved.\n            For example, `{\"pred.pkl\": pred}`\n        \"\"\"\n        if local_path is not None and len(kwargs) > 0:\n            raise ValueError(\n                \"You can choose only one of `local_path`(save the files in a path) or `kwargs`(pass in the objects directly)\"\n            )\n        self.get_exp().get_recorder(start=True).save_objects(local_path, artifact_path, **kwargs)\n\n    def load_object(self, name: Text):\n        \"\"\"\n        Method for loading an object from artifacts in the experiment in the uri.\n        \"\"\"\n        return self.get_exp().get_recorder(start=True).load_object(name)\n\n    def log_params(self, **kwargs):\n        \"\"\"\n        Method for logging parameters during an experiment. In addition to using ``R``, one can also log to a specific recorder after getting it with `get_recorder` API.\n\n        - If `active recorder` exists: it will log parameters through the active recorder.\n        - If `active recorder` not exists: the system will create a default experiment as well as a new recorder, and log parameters under it.\n\n        Here are some use cases:","sourceCodeStart":513,"sourceCodeEnd":549,"githubUrl":"https://github.com/microsoft/qlib/blob/79633dd9506ea689e5400dea0197717b5b3d74b7/qlib/workflow/__init__.py#L513-L549","documentation":"Error \"You can choose only one of `local_path`(save the files in a path) or `kwargs`(pass in the objects directly)\" thrown in microsoft/qlib.","triggerScenarios":"This error is raised at qlib/workflow/__init__.py:531 when the guard condition fails: \"choose only one of local_path or kwargs\". 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.","commonSituations":"See trigger scenarios.","solutions":["Pass only one of `local_path` or `kwargs`, not both.","Remove either the `local_path` argument or the object kwargs from the call."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"79633dd9506ea689e5400dea0197717b5b3d74b7","analyzedAt":"2026-08-15T07:01:27.511Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}