mlflow/mlflow · error · MlflowException
RESOURCE_ALREADY_EXISTS
RESOURCE_ALREADY_EXISTS
Error message
Workspace '{workspace.name}' already exists. What it means
RestWorkspaceStore.create_workspace expects HTTP 201; when the server answers with RESOURCE_ALREADY_EXISTS, the client re-raises it as an MlflowException with code RESOURCE_ALREADY_EXISTS, preserving the server's message when present. It means a workspace with the same name already exists on the server.
Source
Thrown at mlflow/store/workspace/rest_store.py:88
if workspace.default_artifact_root is not None:
request_message.default_artifact_root = workspace.default_artifact_root
if workspace.trace_archival_location is not None:
request_message.trace_archival_config.location = workspace.trace_archival_location
if workspace.trace_archival_retention is not None:
request_message.trace_archival_config.retention = workspace.trace_archival_retention
try:
proto = call_endpoint(
host_creds=self.get_host_creds(),
endpoint=WORKSPACES_ENDPOINT,
method="POST",
json_body=message_to_json(request_message),
response_proto=CreateWorkspace.Response(),
expected_status=201,
)
except RestException as exc:
if exc.error_code == databricks_pb2.ErrorCode.Name(RESOURCE_ALREADY_EXISTS):
message = exc.message or f"Workspace '{workspace.name}' already exists."
raise MlflowException(message, RESOURCE_ALREADY_EXISTS) from exc
raise
return self._workspace_from_proto(proto)
def update_workspace(self, workspace: Workspace) -> Workspace:
request_message = UpdateWorkspace()
if workspace.description is not None:
request_message.description = workspace.description
if workspace.default_artifact_root is not None:
request_message.default_artifact_root = workspace.default_artifact_root
if workspace.trace_archival_location is not None:
request_message.trace_archival_config.location = workspace.trace_archival_location
if workspace.trace_archival_retention is not None:
request_message.trace_archival_config.retention = workspace.trace_archival_retention
proto = call_endpoint(
host_creds=self.get_host_creds(),
endpoint=f"{WORKSPACES_ENDPOINT}/{_quote_workspace(workspace.name)}",
method="PATCH",View on GitHub (pinned to 6a27f2decc)
Solutions
- Call list_workspaces or get_workspace first and skip creation if the name already exists
- Catch MlflowException with error_code RESOURCE_ALREADY_EXISTS and treat it as a no-op if creation is meant to be idempotent
- Use a unique workspace name (e.g. with a team/env suffix) to avoid collisions
Example fix
// before
create_workspace(Workspace(name="team-a")) # raises if exists
// after
try:
create_workspace(Workspace(name="team-a"))
except MlflowException as e:
if e.error_code != "RESOURCE_ALREADY_EXISTS":
raise Defensive patterns
Strategy: try-catch
Validate before calling
existing = {w.name for w in store.list_workspaces()}
if name in existing:
skip_creation = True Try / catch
try:
ws = store.create_workspace(Workspace(name=name))
except MlflowException as e:
if e.error_code == "RESOURCE_ALREADY_EXISTS":
ws = store.get_workspace(name) # treat as idempotent
else:
raise Prevention
- Make provisioning scripts idempotent by checking existence first
- Use get-before-create in CI/CD workspace setup
- Adopt unique naming conventions per team/environment
When it happens
Trigger: POSTing a CreateWorkspace request for a name that is already registered on the tracking server; concurrent creation races where two processes create the same workspace name.
Common situations: Re-running idempotency-broken setup scripts that create workspaces; CI provisioning colliding with an existing workspace; teams sharing a server and independently creating the same workspace name.
Related errors
- RESOURCE_ALREADY_EXISTS
- Move aborted: merging workspaces would create duplicate {res
- Move aborted: the following {resource_type} already exist in
- Downgrade aborted: merging workspaces would create duplicate
- INVALID_STATE
AI-assisted analysis of mlflow/mlflow@6a27f2decc (2026-08-29).
Data as JSON: /api/errors/6aac58621556d5c9.
Report an issue: GitHub.