unslothai/unsloth · warning · RuntimeError
VirusTotal request failed after {max_attempts} attempt(s): {
Error message
VirusTotal request failed after {max_attempts} attempt(s): {last_error} What it means
Thrown by use-chat-model-runtime.ts:1142-1144 via getTrustRemoteCodeRequiredMessage (line 276-278) when validateModel flags requires_trust_remote_code or requires_security_review and the user does not complete the remote-code consent dialog — confirmRemoteCodeIfNeeded resolved approved=false. Models with custom modeling code (trust_remote_code) require an explicit review/approval that records a fingerprint; without approval the worker refuses the load. The dialog fires even when trustRemoteCode is preset, because the worker needs the matching fingerprint only the dialog produces.
Source
Thrown at scripts/virustotal_scan.py:441
if attempt < max_attempts:
self._backoff(backoff * (2 ** (attempt - 1)), deadline)
continue
if status == 0 or status >= 500:
last_error = last_error or f"HTTP {status}"
if attempt < max_attempts:
self._backoff(backoff * (2 ** (attempt - 1)), deadline)
continue
if status >= 400 and status not in allow_status:
raise RuntimeError(f"VirusTotal returned HTTP {status} for {_redact_url(url)}")
if not payload:
return status, None
try:
return status, json.loads(payload.decode("utf-8", "replace"))
except json.JSONDecodeError:
return status, None
raise RuntimeError(
f"VirusTotal request failed after {max_attempts} attempt(s): {last_error}"
)
def lookup_hash(
self,
sha256: str,
deadline: float | None = None,
) -> object | None:
"""Return the existing file report, or None when VirusTotal has never seen it.
Doing this first is both a quota saving and a disclosure saving: a bundle that
VirusTotal already holds gains nothing from being uploaded again.
"""
status, payload = self.request(
"GET",
f"{API_ROOT}/files/{sha256}",
allow_status = (404,),
deadline = deadline,View on GitHub (pinned to 203007d190)
Solutions
- Load the model again, open the review dialog, read the custom code, and approve it — the recorded fingerprint lets the load proceed.
- If the code looks unsafe, do not approve: choose a different model or a transformers-native/GGUF variant that needs no custom code.
- Keep the studio backend updated so more architectures are natively supported and the consent gate disappears for them.
Defensive patterns
Strategy: try-catch
Validate before calling
async function needsRemoteCodeConsent(modelId: string): Promise<boolean> {
const v = await validateModel({ model_path: modelId });
return Boolean(v.requires_trust_remote_code || v.requires_security_review);
} Type guard
function isRemoteCodeApprovalError(e: unknown): e is Error {
return e instanceof Error && /custom code was not approved/.test(e.message);
} Try / catch
try {
await loadModel(selection);
} catch (error) {
if (isRemoteCodeApprovalError(error)) {
// safe to retry: re-run load, complete the review dialog, approve
} else throw error;
} Prevention
- Approve the code-review dialog only after actually reading the custom modeling files.
- Cache the approval fingerprint so repeat loads of the same model don't re-prompt.
- Prefer transformers-native or GGUF builds of architectures you don't trust.
When it happens
Trigger: Loading a Hub model with custom code (or a flagged unsafe file) where validation sets requires_trust_remote_code / requires_security_review, and the user cancels the code-review dialog or rejects the code after reviewing it.
Common situations: Newer/niche architectures not yet in the installed transformers (Phi-style custom models); users wary of remote code; the security review flagging a file in the repo; dialog dismissed with Escape.
Related errors
- VirusTotal returned HTTP {status} for {_redact_url(url)}
- deadline reached while pacing before {method} {_redact_url(u
- VirusTotal hash lookup returned a malformed body
- Embedding model {name!r} {reason}; refusing to load. Set a d
- Refusing to train from untrusted base model '{base_model}'.
AI-assisted analysis of unslothai/unsloth@203007d190 (2026-08-15).
Data as JSON: /api/errors/4dda80e66b9ce121.
Report an issue: GitHub.