microsoft/qlib · error · ValueError

Error: {e}. Something went wrong when deleting recorder. Ple

Error message

Error: {e}. Something went wrong when deleting recorder. Please check if the name/id of the recorder is correct.

What it means

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.

Source

Thrown at qlib/workflow/exp.py:336

        filter_string = "" if kwargs.get("filter_string") is None else kwargs.get("filter_string")
        run_view_type = 1 if kwargs.get("run_view_type") is None else kwargs.get("run_view_type")
        max_results = 100000 if kwargs.get("max_results") is None else kwargs.get("max_results")
        order_by = kwargs.get("order_by")

        return self._client.search_runs([self.id], filter_string, run_view_type, max_results, order_by)

    def delete_recorder(self, recorder_id=None, recorder_name=None):
        assert (
            recorder_id is not None or recorder_name is not None
        ), "Please input a valid recorder id or name before deleting."
        try:
            if recorder_id is not None:
                self._client.delete_run(recorder_id)
            else:
                recorder = self._get_recorder(recorder_name=recorder_name)
                self._client.delete_run(recorder.id)
        except MlflowException as e:
            raise ValueError(
                f"Error: {e}. Something went wrong when deleting recorder. Please check if the name/id of the recorder is correct."
            ) from e

    UNLIMITED = 50000  # FIXME: Mlflow can only list 50000 records at most!!!!!!!

    def list_recorders(
        self,
        rtype: Literal["dict", "list"] = Experiment.RT_D,
        max_results: int = UNLIMITED,
        status: Union[str, None] = None,
        filter_string: str = "",
    ):
        """
        Quoting docs of search_runs
        > The default ordering is to sort by start_time DESC, then run_id.

        Parameters
        ----------

View on GitHub (pinned to 79633dd950)

Solutions

  1. Validate the id against exp.list_recorders() before deleting.
  2. Read the embedded 'Error: {e}' text — it carries the true MLflow cause (404, INVALID_PARAMETER_VALUE, permission).
  3. Ensure the tracking URI/server is reachable and credentials are set when using a remote backend.
  4. Make cleanup idempotent: tolerate 'not found' as success.

Example fix

# before
exp.delete_recorder(recorder_id=some_id)  # ValueError wrapping MlflowException

# after
if some_id in exp.list_recorders():
    exp.delete_recorder(recorder_id=some_id)
Defensive patterns

Strategy: try-catch

Validate before calling

if recorder_id is not None and recorder_id not in exp.list_recorders():
    raise KeyError(f'recorder {recorder_id} absent; nothing to delete')

Try / catch

try:
    exp.delete_recorder(recorder_id=rid)
except ValueError as e:
    msg = str(e)
    if 'not found' in msg or 'INVALID_PARAMETER' in msg:
        pass  # already gone; treat as success for idempotent cleanup
    else:
        raise

Prevention

When it happens

Trigger: 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).

Common situations: 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.

Related errors


AI-assisted analysis of microsoft/qlib@79633dd950 (2026-08-15). Data as JSON: /api/errors/6a6f8ab6b4599c11. Report an issue: GitHub.