unslothai/unsloth · warning · TimeoutError

model load did not reach ready

Error message

model load did not reach ready

What it means

Thrown by parseOptionalBaseUrl (chat-providers-dialog.tsx:452-474) when the trimmed Base URL string cannot be parsed by the URL constructor — new URL(trimmed) threw. This is the studio's custom-provider dialog validating the endpoint field before saving a provider config; the URL constructor requires an absolute URL with scheme, so bare hostnames and relative paths fail.

Source

Thrown at scripts/diffusion_quality.py:189

    try:
        import torch
        if torch.cuda.is_available():
            torch.cuda.reset_peak_memory_stats()
            torch.cuda.synchronize()
    except Exception:
        pass


def _wait_for_load(backend: Any, timeout_s: int = 3600) -> None:
    deadline = time.time() + timeout_s
    while time.time() < deadline:
        p = backend.load_progress()
        if p.get("phase") == "ready":
            return
        if p.get("phase") == "error":
            raise RuntimeError(f"load error: {p.get('error')}")
        time.sleep(2)
    raise TimeoutError("model load did not reach ready")


def _hf_file_size_mib(repo: str, filename: str) -> Optional[int]:
    # Local paths: stat directly, since the Hub lookup returns None and _recommend would drop them.
    try:
        local = Path(repo).expanduser()
        if local.is_dir():
            f = local / filename
            if f.is_file():
                return int(f.stat().st_size // (1024 * 1024))
        elif local.is_file():
            return int(local.stat().st_size // (1024 * 1024))
    except Exception:
        pass
    try:
        from huggingface_hub import HfApi
        info = HfApi().model_info(repo, files_metadata = True, token = os.environ.get("HF_TOKEN"))
        for s in info.siblings:

View on GitHub (pinned to 203007d190)

Solutions

  1. Prefix the URL with http:// or https://, e.g. 'https://api.openai.com/v1'.
  2. Remove any stray leading/trailing spaces or invisible characters pasted from chat/docs.
  3. For local servers use 'http://127.0.0.1:PORT/v1'.
  4. Note the dialog auto-appends /v1 for OpenAI-compatible providers when the path is empty, so a bare origin like 'https://my-gateway' is fine.

Example fix

// before (input value)
api.mistral.ai/v1

// after
https://api.mistral.ai/v1
Defensive patterns

Strategy: validation

Validate before calling

function isValidBaseUrl(input: string): boolean {
  const trimmed = input.trim();
  if (!trimmed) return true; // empty handled by the required check
  try { new URL(trimmed); return true; } catch { return false; }
}

Prevention

When it happens

Trigger: Entering a Base URL without a scheme, e.g. 'localhost:8080/v1' (URL parses port but fails without scheme — actually 'localhost:8080/v1' throws because the scheme is missing), 'api.openai.com/v1', or a string with stray characters/spaces. The catch around new URL() is the sole trigger.

Common situations: Users pasting endpoints without https://; trailing typos like 'https//api...' (missing colon); copying from docs that strip the scheme; entering 'v1/chat/completions' instead of a base URL.

Related errors


AI-assisted analysis of unslothai/unsloth@203007d190 (2026-08-15). Data as JSON: /api/errors/3725d1637d13a7c6. Report an issue: GitHub.