unslothai/unsloth · error · HTTPException
Selected cached model is no longer available.
Error message
Selected cached model is no longer available.
What it means
Raised as a 404 by the model-config helper when latest_snapshot_from_cache_path() cannot find a usable HF-hub snapshot for the requested model under the given local_path. It means the model cache entry the user selected previously no longer resolves to a loadable snapshot (missing config.json/adapter_config.json or the snapshot directory vanished).
Source
Thrown at studio/backend/routes/models.py:2125
def _model_config_inspection_target(
model_name: str, prefer_local_cache: bool, local_path: Optional[str]
) -> str:
if not prefer_local_cache or is_local_path(model_name):
return model_name
from hub.utils.hf_cache_state import (
latest_snapshot_from_cache_path,
with_load_subdirs,
)
snapshot = latest_snapshot_from_cache_path(
local_path,
"model",
canonical_model_repo_id(model_name),
with_load_subdirs(model_name, ("config.json", "adapter_config.json")),
)
if snapshot is None:
raise HTTPException(
status_code = 404,
detail = "Selected cached model is no longer available.",
)
return snapshot
@router.get("/config/{model_name:path}")
async def get_model_config(
model_name: str,
hf_token: Optional[str] = Query(None),
prefer_local_cache: bool = False,
local_path: Optional[str] = None,
header_hf_token: Optional[str] = Depends(get_hf_token),
current_subject: str = Depends(get_current_subject),
):
"""Get configuration for a specific model (wraps load_model_defaults)."""
hf_token = _normalize_hf_token(header_hf_token) or _normalize_hf_token(hf_token)
from core.inference.llama_cpp import _hf_offline_if_unreachable_forView on GitHub (pinned to 203007d190)
Solutions
- Re-download the model snapshot (huggingface-cli download <repo_id>) so the cache contains config.json/adapter_config.json again.
- Inspect local_path/snapshots to confirm a complete snapshot directory exists for canonical_model_repo_id(model_name).
- If the cache was intentionally pruned, clear the stale selection in the UI and re-pick the model so local_path points at a valid entry.
- Fall back to fetching config from the Hub (drop prefer_local_cache / local_path).
Defensive patterns
Strategy: validation
Validate before calling
from pathlib import Path
def snapshot_complete(local_path: str, repo_id: str) -> bool:
snaps = Path(local_path).expanduser() / 'snapshots'
if not snaps.is_dir():
return False
return any(
(s / 'config.json').is_file() or (s / 'adapter_config.json').is_file()
for s in snaps.iterdir() if s.is_dir()
)
if not snapshot_complete(local_path, model_name):
raise FileNotFoundError('cached snapshot missing configs — re-download before requesting config') Try / catch
try:
cfg = client.get(f'/api/models/config/{model}', params={'local_path': lp, 'prefer_local_cache': True})
except HTTPError as e:
if e.response.status_code == 404 and 'no longer available' in e.response.json()['detail']:
cfg = client.get(f'/api/models/config/{model}') # fall back to Hub fetch
else: raise Prevention
- Verify snapshot directories contain config.json/adapter_config.json before selecting them.
- Treat cache-prune operations as invalidating saved local_path selections.
- Keep a Hub fallback path in the client when prefer_local_cache is used.
When it happens
Trigger: GET /api/models/config/{model_name}?local_path=...&prefer_local_cache=true where the HF cache snapshot directory was deleted, pruned (huggingface-cli delete-cache), partially downloaded, or the expected config.json / adapter_config.json files are absent from every candidate snapshot under with_load_subdirs.
Common situations: Cache cleanup tools removing snapshots; interrupted downloads leaving partial snapshots; multi-revision caches where the 'latest' snapshot lacks the needed config; repo id casing mismatch in canonical_model_repo_id.
Related errors
- STT model '{model_id}' is not downloaded. Download it in Set
- dataset_local_cache_miss
- Path does not exist: {os.path.basename(requested_path)}
- Invalid model snapshot repository ID.
- The Hugging Face cache folder is invalid.
AI-assisted analysis of unslothai/unsloth@203007d190 (2026-08-15).
Data as JSON: /api/errors/59268fcbba413968.
Report an issue: GitHub.