{"record":{"id":"6a6f8ab6b4599c11","repo":"microsoft/qlib","slug":"error-e-something-went-wrong-when-deleting-rec","errorCode":null,"errorMessage":"Error: {e}. Something went wrong when deleting recorder. Please check if the name/id of the recorder is correct.","messagePattern":"Error: (.+?)\\. Something went wrong when deleting recorder\\. Please check if the name/id of the recorder is correct\\.","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"qlib/workflow/exp.py","lineNumber":336,"sourceCode":"        filter_string = \"\" if kwargs.get(\"filter_string\") is None else kwargs.get(\"filter_string\")\r\n        run_view_type = 1 if kwargs.get(\"run_view_type\") is None else kwargs.get(\"run_view_type\")\r\n        max_results = 100000 if kwargs.get(\"max_results\") is None else kwargs.get(\"max_results\")\r\n        order_by = kwargs.get(\"order_by\")\r\n\r\n        return self._client.search_runs([self.id], filter_string, run_view_type, max_results, order_by)\r\n\r\n    def delete_recorder(self, recorder_id=None, recorder_name=None):\r\n        assert (\r\n            recorder_id is not None or recorder_name is not None\r\n        ), \"Please input a valid recorder id or name before deleting.\"\r\n        try:\r\n            if recorder_id is not None:\r\n                self._client.delete_run(recorder_id)\r\n            else:\r\n                recorder = self._get_recorder(recorder_name=recorder_name)\r\n                self._client.delete_run(recorder.id)\r\n        except MlflowException as e:\r\n            raise ValueError(\r\n                f\"Error: {e}. Something went wrong when deleting recorder. Please check if the name/id of the recorder is correct.\"\r\n            ) from e\r\n\r\n    UNLIMITED = 50000  # FIXME: Mlflow can only list 50000 records at most!!!!!!!\r\n\r\n    def list_recorders(\r\n        self,\r\n        rtype: Literal[\"dict\", \"list\"] = Experiment.RT_D,\r\n        max_results: int = UNLIMITED,\r\n        status: Union[str, None] = None,\r\n        filter_string: str = \"\",\r\n    ):\r\n        \"\"\"\r\n        Quoting docs of search_runs\r\n        > The default ordering is to sort by start_time DESC, then run_id.\r\n\r\n        Parameters\r\n        ----------\r","sourceCodeStart":318,"sourceCodeEnd":354,"githubUrl":"https://github.com/microsoft/qlib/blob/79633dd9506ea689e5400dea0197717b5b3d74b7/qlib/workflow/exp.py#L318-L354","documentation":"MLflowExperiment.delete_recorder wraps the underlying MlflowClient.delete_run call: any MlflowException (invalid run id, already-deleted run, unreachable tracking server) is re-raised as this ValueError with the original message embedded. Deletion itself failed at the MLflow layer.","triggerScenarios":"exp.delete_recorder(recorder_id='<invalid>') or delete_recorder(recorder_name=...) where _get_recorder resolves an id that delete_run rejects; tracking server down or permission denied; run already deleted (MLflow delete of a deleted run).","commonSituations":"Cleanup loops that delete recorders twice; running against a remote MLflow server with auth issues while mlruns is local; stale ids after regenerating the mlruns directory.","solutions":["Validate the id against exp.list_recorders() before deleting.","Read the embedded 'Error: {e}' text — it carries the true MLflow cause (404, INVALID_PARAMETER_VALUE, permission).","Ensure the tracking URI/server is reachable and credentials are set when using a remote backend.","Make cleanup idempotent: tolerate 'not found' as success."],"exampleFix":"# before\nexp.delete_recorder(recorder_id=some_id)  # ValueError wrapping MlflowException\n\n# after\nif some_id in exp.list_recorders():\n    exp.delete_recorder(recorder_id=some_id)","handlingStrategy":"try-catch","validationCode":"if recorder_id is not None and recorder_id not in exp.list_recorders():\n    raise KeyError(f'recorder {recorder_id} absent; nothing to delete')","typeGuard":null,"tryCatchPattern":"try:\n    exp.delete_recorder(recorder_id=rid)\nexcept ValueError as e:\n    msg = str(e)\n    if 'not found' in msg or 'INVALID_PARAMETER' in msg:\n        pass  # already gone; treat as success for idempotent cleanup\n    else:\n        raise","preventionTips":["Check membership in list_recorders() before deleting.","Keep the tracking URI stable across create/delete operations.","Parse the embedded MLflow error text to distinguish missing runs from server/auth failures."],"tags":["qlib","mlflow","delete","recorder","value-error"],"backgroundTag":null,"analyzedSha":"79633dd9506ea689e5400dea0197717b5b3d74b7","analyzedAt":"2026-08-15T07:01:27.511Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}