{"record":{"id":"0bd8d297ae87a23f","repo":"mlflow/mlflow","slug":"name-and-tag-are-mutually-exclusive","errorCode":null,"errorMessage":"--name and --tag are mutually exclusive.","messagePattern":"--name and --tag are mutually exclusive\\.","errorType":"console","errorClass":"RuntimeError","httpStatus":null,"severity":"warning","filePath":"mlflow/store/db/workspace_move.py","lineNumber":291,"sourceCode":"    Returns a :class:`MoveResult` with ``names`` (sorted list of distinct\n    resource names that were moved or would be moved) and ``row_count`` (the\n    number of rows in the root resource table that were moved; child-table\n    rows such as model versions or tags are not included in this count).\n    For resource types whose names are not unique, ``row_count`` may exceed\n    ``len(names)`` when multiple rows share the same name.\n    \"\"\"\n    if source_workspace == target_workspace:\n        raise RuntimeError(\"Source and target workspaces must be different.\")\n\n    spec = _RESOURCE_SPECS.get(resource_type)\n    if spec is None:\n        raise RuntimeError(\n            f\"Unknown resource type {resource_type!r}. \"\n            f\"Valid types: {', '.join(RESOURCE_TYPE_CHOICES)}\"\n        )\n\n    if names and tags:\n        raise RuntimeError(\"--name and --tag are mutually exclusive.\")\n\n    if tags and spec.tag_table is None:\n        raise RuntimeError(f\"Resource type {resource_type!r} does not support tag filtering.\")\n\n    if artifact_policy not in (\"preserve\", \"retarget\"):\n        raise RuntimeError(f\"Unknown artifact policy {artifact_policy!r}.\")\n\n    if artifact_policy == \"retarget\" and resource_type != \"experiments\":\n        raise RuntimeError(\n            \"--artifact-policy retarget is only supported for --resource-type experiments.\"\n        )\n\n    workspace_store.get_workspace(source_workspace)\n    workspace_store.get_workspace(target_workspace)\n\n    retarget_root = None\n    if artifact_policy == \"retarget\":\n        retarget_root = _resolve_target_artifact_root(","sourceCodeStart":273,"sourceCodeEnd":309,"githubUrl":"https://github.com/mlflow/mlflow/blob/6a27f2decc0b76eb1b54af31849784addb357dbc/mlflow/store/db/workspace_move.py#L273-L309","documentation":"move_resources selects rows either by explicit --name values or by --tag filters, never both. Supplying both raises a RuntimeError to keep the selection unambiguous.","triggerScenarios":"Invoking `mlflow workspace move-resources` with both --name (possibly repeated) and --tag on the same command line.","commonSituations":"Script merging two selection modes, copying a command template and appending a tag filter on top of explicit names, batch tooling that always emits both flags.","solutions":["Choose one selector: drop --tag if you meant to move named resources, or drop --name entries and rely on the tag filter","Split into two invocations if both name-based and tag-based moves are needed","In scripts, build the command with mutually exclusive flag groups"],"exampleFix":"# before: both flags\nmlflow workspace move-resources --workspace team-a --resource-type experiments --name exp1 --tag team=x\n# after: one selector\nmlflow workspace move-resources --workspace team-a --resource-type experiments --tag team=x","handlingStrategy":"validation","validationCode":"def validate_selection_args(names, tags):\n    if names and tags:\n        raise SystemExit('--name and --tag are mutually exclusive; pass one or the other')\n\nvalidate_selection_args(args.name, args.tag)","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Use argparse mutually-exclusive flag groups in wrapper scripts","Emit either --name or --tag from automation, never both","Split mixed selections into separate move invocations"],"tags":["cli","workspace","validation","mutually-exclusive"],"backgroundTag":"invalid-argument-combination","analyzedSha":"6a27f2decc0b76eb1b54af31849784addb357dbc","analyzedAt":"2026-08-29T20:54:51.419Z","schemaVersion":2},"datasetVersion":"2026-08-29T22:17:34.462Z"}