{"record":{"id":"ac1678d94f5bb116","repo":"unslothai/unsloth","slug":"message","errorCode":null,"errorMessage":"{message}","messagePattern":"\\{message\\}","errorType":"http","errorClass":"HTTPException","httpStatus":400,"severity":"error","filePath":"studio/backend/routes/export.py","lineNumber":105,"sourceCode":"    \"\"\"\n    try:\n        await _ensure_export_supported()\n        backend = get_export_backend()\n        # Run in a worker thread (spawns and waits on a subprocess, can take\n        # minutes) so the event loop stays free to serve the live log SSE stream.\n        success, message = await asyncio.to_thread(\n            backend.load_checkpoint,\n            checkpoint_path = request.checkpoint_path,\n            max_seq_length = request.max_seq_length,\n            load_in_4bit = request.load_in_4bit,\n            trust_remote_code = request.trust_remote_code,\n            approved_remote_code_fingerprint = request.approved_remote_code_fingerprint,\n            hf_token = request.hf_token,\n            subject = current_subject,\n        )\n\n        if not success:\n            raise HTTPException(status_code = 400, detail = message)\n\n        return ExportOperationResponse(success = True, message = message)\n    except HTTPException:\n        raise\n    except Exception as e:\n        from utils.transformers_version import SidecarSwapInProgress\n\n        if isinstance(e, SidecarSwapInProgress):\n            # Expected loss of the race against a sidecar install: retryable 409.\n            raise HTTPException(status_code = 409, detail = str(e))\n        logger.error(f\"Error loading checkpoint: {e}\", exc_info = True)\n        raise HTTPException(\n            status_code = 500,\n            detail = \"Failed to load checkpoint\",\n        )\n\n\n@router.post(\"/cleanup\", response_model = ExportOperationResponse)","sourceCodeStart":87,"sourceCodeEnd":123,"githubUrl":"https://github.com/unslothai/unsloth/blob/203007d19051dcd2ae33876786d117c99f6b0368/studio/backend/routes/export.py#L87-L123","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Read the returned message — it names the exact loader failure; fix that specific cause.","Verify checkpoint_path exists on the server filesystem and is a complete checkpoint (config + weights + tokenizer).","For trust_remote_code models, supply the approved_remote_code_fingerprint obtained from the approval flow."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"const st = await api.get('/export/status');\nif (!st.checkpoint_loaded) throw new Error('load a checkpoint first');\nassertServerPathExists(body.checkpoint_path); // optional preflight","typeGuard":null,"tryCatchPattern":"try {\n  await api.post('/export/load-checkpoint', body);\n} catch (e) {\n  if (e.status === 400) showError(e.detail); // backend message names the exact cause\n  throw e;\n}","preventionTips":["Surface the backend's message verbatim — it states the precise loader failure.","Pre-verify checkpoint paths and remote-code approvals before calling."],"tags":["export","checkpoint","http-400","fastapi"],"backgroundTag":null,"analyzedSha":"203007d19051dcd2ae33876786d117c99f6b0368","analyzedAt":"2026-08-15T02:48:39.846Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}