{"record":{"id":"e2c6f1f1983e60ab","repo":"unslothai/unsloth","slug":"multiple-cached-noun-differ-only-by-case-delete","errorCode":null,"errorMessage":"Multiple cached {noun} differ only by case. Delete the exact repo casing from On Device.","messagePattern":"Multiple cached (.+?) differ only by case\\. Delete the exact repo casing from On Device\\.","errorType":"http","errorClass":"HTTPException","httpStatus":409,"severity":"warning","filePath":"studio/backend/hub/services/__init__.py","lineNumber":22,"sourceCode":"\"\"\"Shared helpers for the Hub service layer.\"\"\"\n\nfrom __future__ import annotations\n\nfrom typing import Iterable\n\nfrom fastapi import HTTPException\n\nfrom hub.utils.hf_cache_state import resolve_destructive_case_matches\n\n\ndef resolve_destructive_repo_ids(repo_id: str, candidates: Iterable[str], *, noun: str) -> set[str]:\n    \"\"\"Cache-dir repo ids a destructive op on *repo_id* may target.\n\n    Refuses with 409 on ambiguous case-only matches so a delete never removes\n    the wrong casing. *noun* is the plural shown to the user.\"\"\"\n    resolved = resolve_destructive_case_matches(repo_id, candidates)\n    if resolved is None:\n        raise HTTPException(\n            status_code = 409,\n            detail = (\n                f\"Multiple cached {noun} differ only by case. \"\n                \"Delete the exact repo casing from On Device.\"\n            ),\n        )\n    return resolved\n","sourceCodeStart":4,"sourceCodeEnd":30,"githubUrl":"https://github.com/unslothai/unsloth/blob/203007d19051dcd2ae33876786d117c99f6b0368/studio/backend/hub/services/__init__.py#L4-L30","documentation":"HTTPException 409 raised by resolve_destructive_repo_ids when the HF cache dir contains multiple repos whose ids differ from the requested one only by letter case (resolved by resolve_destructive_case_matches returning None). Deleting could hit the wrong casing on case-insensitive filesystems, so the API refuses the destructive operation and asks the user to delete the exact casing from the On Device UI.","triggerScenarios":"Calling a delete endpoint for a repo while the cache holds e.g. both 'User/Model' and 'user/model' (or other case variants) matching case-insensitively; common after downloading the same repo under differently-cased ids at different times.","commonSituations":"macOS/Windows (case-insensitive FS) caches where both casings were snapshotted; scripts that lowercase repo ids before downloading; re-adding a repo with different capitalization.","solutions":["Open the On Device page and delete the exact repo casing you want removed, one entry at a time.","Clean duplicates by deleting both case variants and re-downloading the correctly-cased repo.","Audit scripts that normalize repo ids to lowercase before download."],"exampleFix":"# before\nDELETE /hub/datasets/user/model   # cache holds both User/Model and user/model -> 409\n\n# after\n# On Device UI: delete 'User/Model' explicitly, then retry the API call for the remaining casing","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"import httpx\n\nresp = httpx.delete(f\"{api}/hub/datasets/{repo_id}\")\nif resp.status_code == 409 and \"differ only by case\" in resp.text:\n    # direct the user to On Device to pick the exact casing\n    show_message(\"Multiple cached casings exist; delete the exact one from On Device.\")","preventionTips":["Always download repos using the exact canonical casing from the Hub.","Never lowercase/normalize repo ids in scripts that write to the HF cache.","When listing cached repos for a delete UI, show and submit the exact stored casing."],"tags":["hf-cache","delete","case-sensitivity","conflict"],"backgroundTag":null,"analyzedSha":"203007d19051dcd2ae33876786d117c99f6b0368","analyzedAt":"2026-08-15T02:48:39.846Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}