unslothai/unsloth · error · HTTPException

{message}

Error message

{message}

What it means

HTTP 400 raised when ExportBackend.load_checkpoint itself reports failure: the call returns a (success, message) tuple and success is False. The backend's own message is passed through verbatim, so this is a domain-level rejection such as a missing checkpoint path, wrong model type, insufficient VRAM, or an invalid max_seq_length — not an exception.

Source

Thrown at studio/backend/routes/export.py:105

    """
    try:
        await _ensure_export_supported()
        backend = get_export_backend()
        # Run in a worker thread (spawns and waits on a subprocess, can take
        # minutes) so the event loop stays free to serve the live log SSE stream.
        success, message = await asyncio.to_thread(
            backend.load_checkpoint,
            checkpoint_path = request.checkpoint_path,
            max_seq_length = request.max_seq_length,
            load_in_4bit = request.load_in_4bit,
            trust_remote_code = request.trust_remote_code,
            approved_remote_code_fingerprint = request.approved_remote_code_fingerprint,
            hf_token = request.hf_token,
            subject = current_subject,
        )

        if not success:
            raise HTTPException(status_code = 400, detail = message)

        return ExportOperationResponse(success = True, message = message)
    except HTTPException:
        raise
    except Exception as e:
        from utils.transformers_version import SidecarSwapInProgress

        if isinstance(e, SidecarSwapInProgress):
            # Expected loss of the race against a sidecar install: retryable 409.
            raise HTTPException(status_code = 409, detail = str(e))
        logger.error(f"Error loading checkpoint: {e}", exc_info = True)
        raise HTTPException(
            status_code = 500,
            detail = "Failed to load checkpoint",
        )


@router.post("/cleanup", response_model = ExportOperationResponse)

View on GitHub (pinned to 203007d190)

Solutions

  1. Read the returned message — it names the exact loader failure; fix that specific cause.
  2. Verify checkpoint_path exists on the server filesystem and is a complete checkpoint (config + weights + tokenizer).
  3. For trust_remote_code models, supply the approved_remote_code_fingerprint obtained from the approval flow.
Defensive patterns

Strategy: try-catch

Validate before calling

const st = await api.get('/export/status');
if (!st.checkpoint_loaded) throw new Error('load a checkpoint first');
assertServerPathExists(body.checkpoint_path); // optional preflight

Try / catch

try {
  await api.post('/export/load-checkpoint', body);
} catch (e) {
  if (e.status === 400) showError(e.detail); // backend message names the exact cause
  throw e;
}

Prevention

When it happens

Trigger: POST /export/load-checkpoint with a checkpoint_path that does not exist, a GGUF/PEFT layout the loader cannot handle, load_in_4bit on hardware without quantization support, or remote code without an approved fingerprint.

Common situations: Stale checkpoint paths after a workspace move; forgetting to approve custom remote code fingerprints; requesting 4-bit loading on CPUs; passing an hf_token without access to the repo.

Related errors


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