MLflow error "INVALID_PARAMETER_VALUE" during model training and logging process

Ensure each MLflow run maintains a unique set of parameters or use nested runs to log each parameter distinctly within a session.

Written by Amruth Ashoka

Last published at: January 29th, 2025

Problem

During model training and the logging process using the MLflow Tracking API, you encounter an error at runtime. 

 

MlflowException('INVALID_PARAMETER_VALUE: This API assumes that the run XXXXXXXX is active. Its current lifecycleStage is deleted
The cause of this error is typically due to repeated calls to an individual run_id event logging.

 

Cause

You’re repeatedly logging the same parameters in the same run. MLflow's design expects each run to maintain a unique parameter set. Logging the same parameter multiple times in the same session creates conflicts within the tracking store.

 

Solution

Ensure you log each parameter only once per run. 

 

If multiple parameter loggings are necessary, use nested runs to separate parameter logs effectively. Here is an example implementation where the first parameter logging in a nested run has a height of 10 and the second parameter logging in a different nested run has a height of 50

 

with mlflow.start_run():
    # First parameter logging in a nested run
    with mlflow.start_run(nested=True):
        mlflow.log_param("height", 10)
    # Second parameter logging in another nested run
    with mlflow.start_run(nested=True):
        mlflow.log_param("height", 50)

 

This approach avoids parameter key (name or identifier) collisions by isolating each logging instance within its own nested run context.