Skip to content
Latchkey

MLflow "RESOURCE_DOES_NOT_EXIST" RestException in CI

The tracking server reached and answered, but the resource the client asked for (an experiment id, run, or registered model) is not there. MLflow raises RestException with the RESOURCE_DOES_NOT_EXIST error code.

What this error means

A step fails with "mlflow.exceptions.RestException: RESOURCE_DOES_NOT_EXIST: Experiment with id ... does not exist" or "Registered Model with name ... not found".

python
mlflow.exceptions.RestException: RESOURCE_DOES_NOT_EXIST: Experiment with id '7'
does not exist.

Common causes

Referencing an id that the CI backend does not have

A hardcoded experiment id (or a run/model name) exists in one backend but not in the fresh CI store, so lookups miss.

The experiment/model was never created in this job

CI starts with an empty store, so logging to an assumed-existing experiment fails until it is created.

How to fix it

Create or look up by name, not a fixed id

Use set_experiment, which creates the experiment if absent, instead of a hardcoded numeric id.

python
import mlflow
mlflow.set_experiment("ci-experiment")  # created if missing
with mlflow.start_run():
    mlflow.log_metric("acc", 0.9)

Register the model before referencing it

Create the registered model (or handle its absence) before loading a version in CI.

python
from mlflow import MlflowClient
client = MlflowClient()
client.create_registered_model("my-model")  # ignore if it exists

How to prevent it

  • Reference experiments and models by name, creating them if missing.
  • Do not hardcode numeric ids that only exist in one backend.
  • Treat the CI tracking store as empty at the start of each run.

Related guides

Tired of flaky CI? Latchkey auto-heals failed jobs and retries them for you. Start free →