Skip to content

armgit / fuobe

Public Imported from GitHub
0

The open creative studio on ComfyUI: images, video, 3D and audio on open weights, on your own GPU or the cloud. Camera motions, effects, apps, Cinema, Layers, Image to 3D and an AI agent.

Your GPU: a model file it can't read is named, with where to get it again

Adarshf5dc32411293
diff --git a/src/components/gpu/trouble.tsx b/src/components/gpu/trouble.tsx
index c8600beb..5704eb45 100644
--- a/src/components/gpu/trouble.tsx
+++ b/src/components/gpu/trouble.tsx
@@ -1,7 +1,7 @@
"use client";
import { useQueryClient, type QueryClient } from "@tanstack/react-query";
-import { CreditCard, ExternalLink, KeyRound, Loader2, Minimize2, Monitor, Play, RefreshCw, RotateCcw, Settings2, Shuffle, Stethoscope } from "lucide-react";
+import { CreditCard, Download, ExternalLink, KeyRound, Loader2, Minimize2, Monitor, Play, RefreshCw, RotateCcw, Settings2, Shuffle, Stethoscope } from "lucide-react";
import Link from "next/link";
import { useEffect, useRef, useState } from "react";
import { toast } from "sonner";
@@ -52,12 +52,15 @@ const ICONS: Record<TroubleActionKind, typeof Play> = {
"use-computer": Monitor,
"send-smaller": Minimize2,
"try-smaller": Minimize2,
+ "get-file": Download,
};
/** The first button stands out (the one most likely to help); the rest are quieter. One line each, cut short when narrow. */
const PILL = "inline-flex h-7 max-w-full min-w-0 items-center gap-1.5 rounded-full px-2.5 text-[12px] font-medium whitespace-nowrap";
const MAIN = "bg-highlight text-highlight-foreground hover:opacity-90";
const QUIET = "bg-secondary hover:bg-accent";
+/** A link that leaves Fuobe (a model file's download): https only. */
+const HTTPS = /^https:\/\/[^\s"'<>]+$/i;
export interface TroubleHandlers {
onRetry?: () => void;
@@ -76,7 +79,7 @@ export interface TroubleHandlers {
* When some buttons must go (a small tile), the ones that help least go first: Settings (Check my GPU leads there too),
* Pair with a code, then the rest. The first button (the one most likely to help) always stays, and the order is kept.
*/
-const DROP_FIRST: TroubleActionKind[] = ["gpu-settings", "pair", "use-computer", "pick-model", "retry", "check-gpu", "key-settings", "try-smaller", "send-smaller", "add-credit", "run-with-key", "start-gpu"];
+const DROP_FIRST: TroubleActionKind[] = ["gpu-settings", "pair", "use-computer", "pick-model", "retry", "check-gpu", "key-settings", "try-smaller", "send-smaller", "add-credit", "run-with-key", "get-file", "start-gpu"];
export function fitActions(actions: TroubleAction[], max?: number): TroubleAction[] {
if (!max || actions.length <= max) return actions;
@@ -136,6 +139,8 @@ export function TroubleActions({
if (a.kind === "use-computer") return !!handlers.onUseComputer;
if (a.kind === "send-smaller") return !!handlers.onSendSmaller;
if (a.kind === "try-smaller") return !!handlers.onTrySmaller;
+ // Where a model file downloads from: only an https link.
+ if (a.kind === "get-file") return !!a.target && HTTPS.test(a.target);
// On a tile, Check my GPU leads to Settings when that is what helps: one button fewer.
if (compact && a.kind === "gpu-settings" && actions.some((x) => x.kind === "check-gpu") && a.label.startsWith("Open Settings")) return false;
return true;
@@ -177,7 +182,7 @@ export function TroubleActions({
const cls = cn(PILL, i === 0 && a.kind !== "retry" ? MAIN : QUIET);
const words = <span className="truncate">{compact ? shortLabel(a) : a.label}</span>;
const stop = (e: React.MouseEvent) => e.stopPropagation();
- if ((a.kind === "start-gpu" || a.kind === "add-credit") && a.target) {
+ if ((a.kind === "start-gpu" || a.kind === "add-credit" || a.kind === "get-file") && a.target) {
return (
<a key={a.kind} href={a.target} target="_blank" rel="noopener noreferrer" onClick={stop} title={a.label} className={cls}>
<Icon className="size-3 shrink-0" /> {words}
diff --git a/src/lib/diagnose.ts b/src/lib/diagnose.ts
index b09bdc90..48077223 100644
--- a/src/lib/diagnose.ts
+++ b/src/lib/diagnose.ts
@@ -41,6 +41,8 @@ export type TroubleCause =
| "gpu-out-of-memory"
| "gpu-stopped-run"
| "gpu-job-error"
+ /** A model file a loader can't read (damaged, cut short) or doesn't have: words name the file. */
+ | "gpu-model-file"
| "gpu-restarted"
| "gpu-moved"
| "gpu-went-away"
@@ -81,12 +83,14 @@ export type TroubleActionKind =
/** Send a smaller copy of the file the GPU's address refused as too big (a run made again with it, on a click). */
| "send-smaller"
/** Run it again one size or length smaller (out of memory), on a click. */
- | "try-smaller";
+ | "try-smaller"
+ /** Open where a model file downloads from (an https link: the file, or a gated file's Hugging Face page). */
+ | "get-file";
export interface TroubleAction {
kind: TroubleActionKind;
label: string;
- /** A link (start-gpu, add-credit, gpu-settings, key-settings, pair) or the provider (run-with-key). */
+ /** A link (start-gpu, add-credit, gpu-settings, key-settings, pair, get-file) or the provider (run-with-key). */
target?: string;
/** run-with-key: the model that runs this tool on that key (its cloud version), and its operation there. */
modelId?: string;
@@ -211,6 +215,7 @@ const A = {
smaller: (): TroubleAction => ({ kind: "send-smaller", label: "Send a smaller copy" }),
trySmaller: (): TroubleAction => ({ kind: "try-smaller", label: "Try one size smaller" }),
connectGpu: (): TroubleAction => ({ kind: "gpu-settings", label: "Connect your GPU", target: "/settings#your-gpu" }),
+ getFile: (url: string): TroubleAction => ({ kind: "get-file", label: "Get the file", target: url }),
};
/**
@@ -539,9 +544,114 @@ export const isOutOfMemoryText = (s: string) => OOM.test(s);
const minutes = (n: number) => `${n} minute${n === 1 ? "" : "s"}`;
+// ---------------------------------------------------------------------------
+// A model file a loader can't read
+
+/** The files a loader reads its model from. */
+export const MODEL_FILE = /\.(safetensors|ckpt|pt|pth|bin|gguf|sft)$/i;
+const MODEL_FILE_IN_TEXT = /[^\s'"`,:;()[\]{}<>|\\/]{1,200}\.(?:safetensors|ckpt|pt|pth|bin|gguf|sft)\b/gi;
+/**
+ * A node that loads a model file: VAELoader, UNETLoader, CheckpointLoaderSimple, CLIPLoader, DualCLIPLoader, LoraLoader
+ * and LoraLoaderModelOnly, ControlNetLoader, UpscaleModelLoader, a GGUF loader.
+ */
+export const isLoaderNode = (nodeType: string | undefined): boolean => !!nodeType && /Loader/.test(nodeType);
+/** A file that is there but can't be read: damaged, cut short, a web page saved under its name, or another format. */
+const UNREADABLE_FILE =
+ /['"]?utf-?8['"]? codec can'?t decode|invalid load key|Error while deserializing header|HeaderTooLarge|SafetensorError|incomplete metadata|MetadataIncompleteBuffer|unexpected EOF|PytorchStreamReader failed|not a zip file|failed finding central directory/i;
+/**
+ * A file that isn't there: the system's words, ComfyUI's own ("Model in folder 'vae' with filename '…' not found"), or
+ * what an older ComfyUI says when a loader opens a name its folder doesn't have (no path to open).
+ */
+const MISSING_FILE = /No such file or directory|FileNotFoundError|\[Errno 2\]|Model in folder .{0,80} with filename .{0,400} not found|expected str, bytes or os\.PathLike object, not NoneType/i;
+
+/**
+ * What a node's error says about its model file: it can't be read ("damaged"), it isn't there ("missing"), or nothing
+ * (another problem, or a node that loads no model file).
+ */
+export function modelFileProblem(nodeType: string | undefined, message: string | undefined): "damaged" | "missing" | null {
+ if (!isLoaderNode(nodeType)) return null;
+ const m = String(message ?? "").slice(0, 4096);
+ if (MISSING_FILE.test(m) || (/not in list/i.test(m) && new RegExp(MODEL_FILE_IN_TEXT.source, "i").test(m))) return "missing";
+ return UNREADABLE_FILE.test(m) ? "damaged" : null;
+}
+
+/** A file name as the person's ComfyUI lists it, safe to show: one line, short. */
+const shownFile = (name: string) =>
+ [...name]
+ .filter((c) => c.charCodeAt(0) >= 32 && c.charCodeAt(0) !== 127)
+ .join("")
+ .trim()
+ .slice(0, 160);
+
+/** The model files among a node's inputs (a value that names a file; links to other nodes are left out). */
+function fileValues(inputs: unknown): string[] {
+ if (!inputs || typeof inputs !== "object") return [];
+ const out: string[] = [];
+ for (const v of Object.values(inputs as Record<string, unknown>)) {
+ // ComfyUI's current_inputs keeps each value in a list.
+ for (const x of Array.isArray(v) ? v : [v]) if (typeof x === "string" && MODEL_FILE.test(x.trim())) out.push(x.trim());
+ }
+ return out;
+}
+
+/** The last part of a file's name ("vae/x.safetensors" and "vae\\x.safetensors" are "x.safetensors"). */
+const baseOf = (name: string) => name.split(/[\\/]/).pop() ?? name;
+
+/**
+ * The model file a loader that failed was reading: its inputs in the graph that was sent (by the error's node id), else
+ * the inputs ComfyUI reported with the error, else every node of that class in the graph, else a file the error names.
+ * One the error names wins; when it can't be told which, all of them (at most three).
+ */
+export function loaderFiles(err: { node_id?: unknown; node_type?: unknown; exception_message?: unknown; current_inputs?: unknown }, graph?: unknown): string[] {
+ const g = graph && typeof graph === "object" ? (graph as Record<string, { class_type?: unknown; inputs?: unknown } | undefined>) : undefined;
+ const id = typeof err.node_id === "string" || typeof err.node_id === "number" ? String(err.node_id) : undefined;
+ const said = String(err.exception_message ?? "").slice(0, 4096);
+ const node = id ? g?.[id] : undefined;
+ let found = node ? fileValues(node.inputs) : [];
+ if (!found.length) found = fileValues(err.current_inputs);
+ if (!found.length && g && typeof err.node_type === "string") found = Object.values(g).flatMap((n) => (n && n.class_type === err.node_type ? fileValues(n.inputs) : []));
+ found = [...new Set(found.map(shownFile).filter(Boolean))];
+ const named = found.filter((f) => said.includes(baseOf(f)));
+ if (named.length) return named.slice(0, 3);
+ if (found.length) return found.slice(0, 3);
+ const inText = [...new Set((said.match(MODEL_FILE_IN_TEXT) ?? []).map(shownFile).filter(Boolean))];
+ return inText.slice(0, 1);
+}
+
+/** A model file a loader can't read, or doesn't have: the file named, where to get it again, never Retry (it can't help). */
+function modelFileTrouble(problem: "damaged" | "missing", e: { nodeType?: string; message?: string; files?: string[]; fileUrl?: string }, place: GpuPlace): Diagnosis {
+ const files = (e.files ?? []).map(shownFile).filter(Boolean).slice(0, 3);
+ const named = files.join(" or ");
+ const words =
+ problem === "missing"
+ ? named
+ ? `Your GPU doesn't have the model file ${named}. Add it, then run.`
+ : "Your GPU doesn't have a model file this needs. Add it, then run."
+ : named
+ ? `A model file on your GPU can't be read: ${named}. It's damaged or didn't finish downloading. Download it again, then run.`
+ : "A model file on your GPU can't be read. It's damaged or didn't finish downloading. Download it again, then run.";
+ const url = e.fileUrl && /^https:\/\/[^\s"'<>]+$/i.test(e.fileUrl) ? e.fileUrl : undefined;
+ const said = cleanDetails(withoutAddress(String(e.message ?? ""), place.kind === "link" ? place.url : undefined), 160);
+ return {
+ cause: "gpu-model-file",
+ words,
+ details: joinDetails(e.nodeType, said),
+ // Check my GPU asks a GPU at a web address (this computer and a paired ComfyUI have their own notes).
+ actions: [...(url ? [A.getFile(url)] : []), ...(place.kind === "link" ? [A.check()] : [])],
+ retryable: false,
+ };
+}
+
/** A job that failed on the person's own GPU while it ran: its own words for the details line, plain words above. */
export type GpuJobTrouble =
- | { kind: "error"; nodeType?: string; message?: string }
+ | {
+ kind: "error";
+ nodeType?: string;
+ message?: string;
+ /** A loader's model file (loaderFiles), and where it downloads from (https), for a file it can't read or doesn't have. */
+ files?: string[];
+ fileUrl?: string;
+ }
| { kind: "interrupted" }
| { kind: "lost"; resent?: boolean }
| { kind: "moved" }
@@ -558,6 +668,8 @@ export function diagnoseGpuJob(e: GpuJobTrouble, place: GpuPlace): Diagnosis {
case "error": {
const msg = (e.message ?? "").trim();
if (isOutOfMemoryText(msg)) return { cause: "gpu-out-of-memory", words: OUT_OF_MEMORY_WORDS, details: joinDetails(e.nodeType, cleanDetails(msg, 120)), actions: [A.trySmaller(), A.retry(), A.pick()], retryable: false };
+ const file = modelFileProblem(e.nodeType, msg);
+ if (file) return modelFileTrouble(file, e, place);
return {
cause: "gpu-job-error",
words: "Your GPU hit a problem while making this. Press Retry, or update your add-ons.",
diff --git a/src/server/providers/comfyui.ts b/src/server/providers/comfyui.ts
index 6b41fc57..26912f7c 100644
--- a/src/server/providers/comfyui.ts
+++ b/src/server/providers/comfyui.ts
@@ -46,7 +46,8 @@ import { outsideTenant, runAsTenant, tenantAccount } from "../tenant";
import { ask, checkReach, reachSync, sharedCheck, type Reach } from "./reach";
import { ProviderError, type PollResult, type ProviderAdapter, type RemoteOutput } from "./types";
import { isOutOfMemory } from "@/lib/gpu/fix-codes";
-import { diagnoseGpu, diagnoseGpuJob, diagnoseRefusal, type Diagnosis, type GpuFailure, type GpuStage } from "@/lib/diagnose";
+import { diagnoseGpu, diagnoseGpuJob, diagnoseRefusal, isLoaderNode, loaderFiles, MODEL_FILE, modelFileProblem, type Diagnosis, type GpuFailure, type GpuJobTrouble, type GpuPlace, type GpuStage } from "@/lib/diagnose";
+import { hfPage } from "@/lib/gpu/plan";
import {
makingWords,
META_BATCH_HISTORY,
@@ -1359,7 +1360,77 @@ function explainExecutionError(err: { exception_message?: string; node_type?: st
return `${err.node_type}: ${msg}`;
}
-const executionError = (entry: HistoryEntry) => entry.status?.messages?.find(([t]) => t === "execution_error")?.[1] as { exception_message?: string; node_type?: string } | undefined;
+type ExecutionError = { exception_message?: string; node_type?: string; node_id?: string; current_inputs?: unknown };
+const executionError = (entry: HistoryEntry) => entry.status?.messages?.find(([t]) => t === "execution_error")?.[1] as ExecutionError | undefined;
+
+/**
+ * Where a model file downloads from, for an account whose GPU has it damaged or lacks it: the requirement index's
+ * (pinned to its revision), the workflow's own list, or a LoRA's page. A gated file: its Hugging Face page (its licence
+ * first). Only an https link.
+ */
+export function modelFileUrl(file: string, manifest?: Pick<ManifestWorkflow, "models">): string | undefined {
+ const name = (file.split(/[\\/]/).pop() ?? file).toLowerCase();
+ const https = (u: string | undefined) => (u && /^https:\/\/[^\s"'<>]+$/i.test(u) ? u : undefined);
+ let indexed: { url: string; pinnedUrl?: string; gated?: boolean } | undefined;
+ try {
+ indexed = Object.values(loadIndex().files).find((f) => f.file.toLowerCase() === name);
+ } catch {}
+ if (indexed) return https(indexed.gated ? hfPage(indexed.url) : indexed.pinnedUrl || indexed.url);
+ const listed = manifest?.models.find((m) => (m.file.split(/[\\/]/).pop() ?? m.file).toLowerCase() === name);
+ if (listed?.url) return https(listed.gated ? hfPage(listed.url) : needsToken(listed.url) ? undefined : listed.url);
+ return https(loraByFile(file.split(/[\\/]/).pop() ?? file)?.page);
+}
+
+/**
+ * A job's error as diagnose.ts reads it. A loader that can't read its model file, or doesn't have it: the file it was
+ * loading (from the graph that was sent, by the error's node id) and where it downloads from.
+ */
+function jobErrorOf(err: ExecutionError | undefined, graph: unknown, manifest: ManifestWorkflow | undefined): Extract<GpuJobTrouble, { kind: "error" }> {
+ const base = { kind: "error" as const, nodeType: err?.node_type, message: err?.exception_message };
+ if (!err || !modelFileProblem(err.node_type, err.exception_message)) return base;
+ const files = loaderFiles(err, graph);
+ const fileUrl = files.length === 1 ? modelFileUrl(files[0], manifest) : undefined;
+ return { ...base, files, ...(fileUrl && { fileUrl }) };
+}
+
+/**
+ * A job that failed on an account's own GPU at a web address, said plainly with what helps: stopped there, out of memory,
+ * a model file its loader can't read or doesn't have (named, with where to get it again), or an add-on's exception.
+ * ComfyUI's own words go in the details line.
+ */
+function ownJobFailed(entry: HistoryEntry, manifest: ManifestWorkflow | undefined, link: GpuPlace): { state: "failed"; error: string; trouble: Diagnosis } {
+ const err = executionError(entry);
+ const said = explainExecutionError(err, manifest);
+ const interrupted = !err && entry.status?.messages?.some(([type]) => type === "execution_interrupted");
+ const d: Diagnosis = interrupted
+ ? diagnoseGpuJob({ kind: "interrupted" }, link)
+ : err && !modelFileProblem(err.node_type, err.exception_message) && said !== `${err.node_type}: ${(err.exception_message ?? "").trim()}`
+ ? { cause: "gpu-job-error", words: said, actions: [{ kind: "retry", label: "Retry" }], retryable: false }
+ : diagnoseGpuJob(jobErrorOf(err, entry.prompt?.[2], manifest), link);
+ return { state: "failed", error: d.words, trouble: d };
+}
+
+/**
+ * A /prompt refusal on an account's own GPU for a model file a loader doesn't list, one no "Fix it" knows (a file outside
+ * the workflow's list): the file named, with where to get it.
+ */
+function unlistedModelFile(body: PromptRefusalBody, manifest: ManifestWorkflow, place: GpuPlace): Diagnosis | null {
+ const errs = body.node_errors && typeof body.node_errors === "object" ? Object.values(body.node_errors as Record<string, unknown>) : [];
+ for (const raw of errs.slice(0, 64)) {
+ const ne = raw as { class_type?: unknown; errors?: unknown } | null;
+ const cls = typeof ne?.class_type === "string" ? ne.class_type : undefined;
+ if (!isLoaderNode(cls) || !Array.isArray(ne?.errors)) continue;
+ for (const e of ne.errors.slice(0, 16) as { message?: unknown; details?: unknown; extra_info?: { received_value?: unknown } }[]) {
+ const file = e?.extra_info?.received_value;
+ if (typeof file !== "string" || !MODEL_FILE.test(file.trim()) || !/not in list/i.test(`${e.message ?? ""} ${e.details ?? ""}`)) continue;
+ const details = String(e.details ?? "").slice(0, 600);
+ const message = `${String(e.message ?? "Value not in list")}: ${details.includes(file.trim()) ? details : file.trim()}`;
+ const fileUrl = modelFileUrl(file.trim(), manifest);
+ return diagnoseGpuJob({ kind: "error", nodeType: cls, message, files: [file.trim()], ...(fileUrl && { fileUrl }) }, place);
+ }
+ }
+ return null;
+}
const promptHasPrefix = (prompt: unknown, prefix: string) =>
!!prompt && typeof prompt === "object" && Object.values(prompt as ComfyWorkflow).some((n) => n?.inputs?.filename_prefix === prefix);
@@ -1392,7 +1463,7 @@ export function metaBatchResults<E extends { prompt?: unknown[] }>(passes: E[],
* VHS meta-batching re-queues the prompt (new prompt ids) until every frame is done; only the last pass
* saves the video. Follow the passes by their shared filename prefix.
*/
-async function followMetaBatch(prefix: string, manifest: ManifestWorkflow | undefined, worker: ComfyWorker): Promise<ComfyOutput[] | "running" | { error: string } | null> {
+async function followMetaBatch(prefix: string, manifest: ManifestWorkflow | undefined, worker: ComfyWorker): Promise<ComfyOutput[] | "running" | { error: string; failed: HistoryEntry } | null> {
const queue = await comfyJson<{ queue_running?: unknown[][]; queue_pending?: unknown[][] }>("/queue", worker);
if ([...(queue.queue_running ?? []), ...(queue.queue_pending ?? [])].some((q) => promptHasPrefix(q[2], prefix))) return "running";
const read = async (n: number) => Object.values(await comfyJson<Record<string, HistoryEntry>>(`/history?max_items=${n}`, worker)).filter((e) => promptHasPrefix(e.prompt?.[2], prefix));
@@ -1402,7 +1473,7 @@ async function followMetaBatch(prefix: string, manifest: ManifestWorkflow | unde
if (passes.some((e) => collect(e).some(isFrame))) passes = await read(META_BATCH_HISTORY);
// A pass that failed (out of memory, a node exception) ends the job: say why instead of "no output".
const failed = passes.find((e) => e.status?.status_str === "error");
- if (failed) return { error: explainExecutionError(executionError(failed), manifest) };
+ if (failed) return { error: explainExecutionError(executionError(failed), manifest), failed };
const files = metaBatchResults(passes, collect);
return files.length ? files : null;
}
@@ -1604,7 +1675,12 @@ export function planRelayOutputs(t: Pick<TaskRow, "id" | "workflow_id" | "meta_b
const failed = list.find((e) => e?.status?.status_str === "error");
if (failed) {
const interrupted = failed.status?.messages?.some(([type]) => type === "execution_interrupted");
- return { error: interrupted ? RELAY_WORDS.stopped : explainExecutionError(executionError(failed), manifest) };
+ if (interrupted) return { error: RELAY_WORDS.stopped };
+ // An account's own computer or paired ComfyUI (never the workers): a model file its loader can't read, or doesn't
+ // have, is kept as what it is, and said plainly with where to get it when the run is read (relayFailure).
+ const err = executionError(failed);
+ if (tenantAccount() && !t.pools && err && modelFileProblem(err.node_type, err.exception_message)) return { error: modelFileTaskError(jobErrorOf(err, failed.prompt?.[2], manifest)) };
+ return { error: explainExecutionError(err, manifest) };
}
const collect = (e: HistoryEntry) => collectOutputs(e, manifest, `relay:${t.id}`);
let outputs: ComfyOutput[] = passes ? metaBatchResults(list, collect) : list[0] ? collect(list[0]) : [];
@@ -1655,17 +1731,43 @@ export function planRelayOutputs(t: Pick<TaskRow, "id" | "workflow_id" | "meta_b
/** An account's ComfyUI that refused a job without saying why: plain words (the owner's keep the status). */
const REFUSED_PLAIN = "Your ComfyUI couldn't start this run. Update your add-ons, then press Retry.";
-/** A task's error as the run's words (and what was missing, for "Fix it"). */
-function relayFailure(t: TaskRow, manifest: ManifestWorkflow | undefined): { error: string; fix?: GenerationFix } {
+/** A relay task's error for a model file an account's loader can't read or doesn't have: what diagnose.ts reads, as JSON. */
+const MODEL_FILE_TASK = "model-file:";
+
+function modelFileTaskError(e: Extract<GpuJobTrouble, { kind: "error" }>): string {
+ return MODEL_FILE_TASK + JSON.stringify({ node: e.nodeType?.slice(0, 128), said: e.message?.slice(0, 1024), files: e.files, url: e.fileUrl });
+}
+
+/** That error, as the run's plain words with what helps (on the account's own computer or paired ComfyUI). */
+function modelFileTaskFailure(e: string): { error: string; trouble: Diagnosis } | null {
+ if (!e.startsWith(MODEL_FILE_TASK)) return null;
+ let j: { node?: unknown; said?: unknown; files?: unknown; url?: unknown } = {};
+ try {
+ j = (JSON.parse(e.slice(MODEL_FILE_TASK.length)) ?? {}) as typeof j;
+ } catch {}
+ const str = (v: unknown) => (typeof v === "string" ? v : undefined);
+ const files = Array.isArray(j.files) ? j.files.filter((f): f is string => typeof f === "string") : [];
+ const fileUrl = str(j.url);
+ const d = diagnoseGpuJob({ kind: "error", nodeType: str(j.node), message: str(j.said), files, ...(fileUrl && { fileUrl }) }, { kind: "computer" });
+ return { error: d.words, trouble: d };
+}
+
+/** A task's error as the run's words (and what was missing, for "Fix it"; for a model file, what helps). */
+export function relayFailure(t: TaskRow, manifest: ManifestWorkflow | undefined): { error: string; fix?: GenerationFix; trouble?: Diagnosis } {
const refusal = refusalOf(t);
if (refusal && manifest) {
const r = promptRefusal((refusal.body ?? {}) as PromptRefusalBody, refusal.status, manifest, extraOf(t).loras ?? []);
+ // An account's own computer or paired ComfyUI: a model file outside the workflow's list ("Fix it" doesn't know it), named.
+ const file = tenantAccount() && !t.pools && !r.fix && !r.plain ? unlistedModelFile((refusal.body ?? {}) as PromptRefusalBody, manifest, { kind: "computer" }) : null;
+ if (file) return { error: file.words, trouble: file };
return { error: r.message ?? (tenantAccount() ? REFUSED_PLAIN : `Your ComfyUI refused the job (HTTP ${refusal.status})`), ...(r.fix && { fix: r.fix }) };
}
if (refusal) return { error: tenantAccount() ? REFUSED_PLAIN : `Your ComfyUI refused the job (HTTP ${refusal.status})` };
const e = t.error ?? "";
const tab = /^tab:([a-z-]+)(?::(\d+))?$/.exec(e);
if (tab) return { error: tabFailureWords(tab[1] as TabFailure, tab[2] ? Number(tab[2]) : undefined, !!tenantAccount()) };
+ const file = modelFileTaskFailure(e);
+ if (file) return file;
const words: Record<string, string> = { lost: RELAY_WORDS.lost, silent: RELAY_WORDS.computerSilent, down: RELAY_WORDS.comfyDownTooLong, tooBig: RELAY_WORDS.tooBig };
if (e === "full") {
const account = tenantAccount();
@@ -1902,7 +2004,7 @@ export const comfyProvider: ProviderAdapter = {
if (!refusal.message) throw gpuTrouble({ stage: "prompt", status: res.status, body: answer.slice(0, 4096), contentType: res.headers.get("content-type") ?? undefined }, link);
const d: Diagnosis = refusal.plain
? { cause: "gpu-refused", words: refusal.message, ...(refusal.details && { details: refusal.details }), actions: [{ kind: "retry", label: "Retry" }], retryable: false }
- : diagnoseRefusal(refusal.message);
+ : ((!refusal.fix && unlistedModelFile(body, manifest, link)) || diagnoseRefusal(refusal.message));
throw Object.assign(troubleError(d, res.status), refusal.fix ? { fix: refusal.fix } : {});
}
throw Object.assign(new ProviderError(refusal.message ?? `ComfyUI /prompt failed (${res.status})`, res.status), refusal.fix ? { fix: refusal.fix } : {});
@@ -1934,19 +2036,10 @@ export const comfyProvider: ProviderAdapter = {
if (manifest && CONTEXT_LOOP_IDS.has(manifest.id) && typeof meta.generationId === "string") void deleteRunFolder(runName(meta.generationId), worker);
if (entry.status?.status_str === "error") {
forget(externalId);
+ // An account's link: stopped there, out of memory, a model file it can't read, or an add-on's exception, said
+ // plainly (its words go in details).
const link = ownLink();
- if (link) {
- // An account's link: stopped there, out of memory, or an add-on's exception, said plainly (its words go in details).
- const err = executionError(entry);
- const said = explainExecutionError(err, manifest);
- const interrupted = !err && entry.status?.messages?.some(([type]) => type === "execution_interrupted");
- const d = interrupted
- ? diagnoseGpuJob({ kind: "interrupted" }, link)
- : err && said !== `${err.node_type}: ${(err.exception_message ?? "").trim()}`
- ? { cause: "gpu-job-error" as const, words: said, actions: [{ kind: "retry" as const, label: "Retry" }], retryable: false }
- : diagnoseGpuJob({ kind: "error", nodeType: err?.node_type, message: err?.exception_message }, link);
- return { state: "failed" as const, error: d.words, trouble: d };
- }
+ if (link) return ownJobFailed(entry, manifest, link);
return { state: "failed" as const, error: explainExecutionError(executionError(entry), manifest) };
}
let outputs = collectOutputs(entry, manifest, baseUrl(worker), authHeaders(worker));
@@ -1956,7 +2049,8 @@ export const comfyProvider: ProviderAdapter = {
if (next === "running") return { state: "running" as const, message: "Rendering the next batch of frames" };
if (next && "error" in next) {
forget(externalId);
- return { state: "failed" as const, error: next.error };
+ const link = ownLink();
+ return link ? ownJobFailed(next.failed, manifest, link) : { state: "failed" as const, error: next.error };
}
outputs = next ?? [];
}
diff --git a/tests/comfy-provider.test.ts b/tests/comfy-provider.test.ts
index 0c387541..b3d27fab 100644
--- a/tests/comfy-provider.test.ts
+++ b/tests/comfy-provider.test.ts
@@ -399,6 +399,61 @@ describe("ComfyUI output mapping", () => {
});
});
+describe("a model file a loader can't read: plain words on an account's own GPU only", () => {
+ const VAE = "minimax_h3_video_vae_int8_convrot.safetensors";
+ const LIVE = "'utf-8' codec can't decode byte 0xf7 in position 0: invalid start byte";
+ const graph = {
+ "14": { class_type: "VAELoader", inputs: { vae_name: VAE } },
+ "15": { class_type: "VAELoader", inputs: { vae_name: "minimax_h3_audio_vae_fp32.safetensors" } },
+ };
+ const failedEntry = (id: string) => ({
+ prompt: [1, id, graph],
+ status: { status_str: "error", messages: [["execution_error", { node_id: "14", node_type: "VAELoader", exception_message: LIVE }]] as [string, Record<string, unknown>][] },
+ outputs: {},
+ });
+
+ it("the owner's runs keep ComfyUI's words", async () => {
+ handler = () => json({ "p-vae": failedEntry("p-vae") });
+ expect(await comfyProvider.poll(pollCtx("p-vae"))).toEqual({ state: "failed", error: `VAELoader: ${LIVE}` });
+ });
+
+ it("a computer's run: an account's says which file and where to get it; the owner's and the workers' keep the words", async () => {
+ const { onComputer, planRelayOutputs, relayFailure, modelFileUrl } = await import("@/server/providers/comfyui");
+ const t = { id: "task-vae", workflow_id: "minimax-h3-t2v", meta_batch: 0, prefix: null, pools: null } as unknown as Parameters<typeof planRelayOutputs>[0];
+ const entries = [failedEntry("p1")];
+ expect(onComputer("owner", () => planRelayOutputs(t, entries, false))).toEqual({ error: `VAELoader: ${LIVE}` });
+ // This studio's GPUs (the workers) running an account's job: their words, as before.
+ expect(onComputer("acct:someone", () => planRelayOutputs({ ...t, pools: "pool" }, entries, false))).toEqual({ error: `VAELoader: ${LIVE}` });
+ const plan = onComputer("acct:someone", () => planRelayOutputs(t, entries, false));
+ expect("error" in plan).toBe(true);
+ const task = { ...t, state: "failed", error: (plan as { error: string }).error, refusal_json: null } as unknown as Parameters<typeof relayFailure>[0];
+ const read = onComputer("acct:someone", () => relayFailure(task, undefined));
+ expect(read.error).toBe(`A model file on your GPU can't be read: ${VAE}. It's damaged or didn't finish downloading. Download it again, then run.`);
+ expect(read.trouble).toMatchObject({ cause: "gpu-model-file", retryable: false, details: `VAELoader · ${LIVE}` });
+ // This computer: no Check my GPU (it asks a GPU at a web address); where the file downloads from.
+ expect(read.trouble?.actions).toEqual([{ kind: "get-file", label: "Get the file", target: modelFileUrl(VAE) }]);
+ expect(modelFileUrl(VAE)).toMatch(/^https:\/\/huggingface\.co\/Kijai\/MiniMax-H3-experimental\/resolve\/[0-9a-f]{40}\/minimax_h3_video_vae_int8_convrot\.safetensors$/);
+ // A file in a folder, and one nothing knows.
+ expect(modelFileUrl(`vae/${VAE}`)).toBe(modelFileUrl(VAE));
+ expect(modelFileUrl("my_own_vae_v2.safetensors")).toBeUndefined();
+ });
+
+ it("an account's computer refusing a file outside the workflow's list: the file named, no Retry", async () => {
+ const { onComputer, relayFailure, getWorkflow: wf } = await import("@/server/providers/comfyui");
+ const file = "my_own_vae_v2.safetensors";
+ const body = { error: { type: "prompt_outputs_failed_validation", message: "Prompt outputs failed validation" }, node_errors: { "14": { class_type: "VAELoader", errors: [{ type: "value_not_in_list", message: "Value not in list", details: `vae_name: '${file}' not in ['ae.safetensors']`, extra_info: { input_name: "vae_name", received_value: file } }] } } };
+ const task = { id: "task-ref", workflow_id: "minimax-h3-t2v", pools: null, state: "failed", error: null, refusal_json: JSON.stringify({ status: 400, body }) } as unknown as Parameters<typeof relayFailure>[0];
+ const manifest = wf("minimax-h3-t2v").manifest;
+ const read = onComputer("acct:someone", () => relayFailure(task, manifest));
+ expect(read.error).toBe(`Your GPU doesn't have the model file ${file}. Add it, then run.`);
+ expect(read.trouble?.cause).toBe("gpu-model-file");
+ expect(read.trouble?.actions.map((a) => a.kind)).not.toContain("retry");
+ // The owner's computer, and the workers: as before.
+ expect(onComputer("owner", () => relayFailure(task, manifest)).trouble).toBeUndefined();
+ expect(onComputer("acct:someone", () => relayFailure({ ...task, pools: "pool" }, manifest)).trouble).toBeUndefined();
+ });
+});
+
describe("ComfyUI uploads and submit", () => {
/** A minimal MP4: ftyp + moov with mvhd and one video trak (tkhd 1280x720, mdhd, hdlr vide, stts 50 frames). */
function tinyMp4(): Buffer {
diff --git a/tests/diagnose.test.ts b/tests/diagnose.test.ts
index 5f52903e..23dd85ed 100644
--- a/tests/diagnose.test.ts
+++ b/tests/diagnose.test.ts
@@ -14,7 +14,10 @@ import {
diagnoseKeyJob,
diagnoseRefusal,
gpuHostOf,
+ isLoaderNode,
ISOLATED_ON_GPU,
+ loaderFiles,
+ modelFileProblem,
retryPlan,
RUNPOD_CONSOLE_URL,
shortState,
@@ -198,6 +201,123 @@ describe("Your GPU: a run that failed there", () => {
});
});
+describe("Your GPU: a model file a loader can't read, or doesn't have", () => {
+ // The reported case: MiniMax H3 on an account's own GPU through a tunnel, five times the same error in a VAELoader.
+ const VIDEO_VAE = "minimax_h3_video_vae_int8_convrot.safetensors";
+ const LIVE = "'utf-8' codec can't decode byte 0xf7 in position 0: invalid start byte";
+ const graph = {
+ "12": { class_type: "UNETLoader", inputs: { unet_name: "minimax_h3_fast_fp8_scaled.safetensors", weight_dtype: "default" } },
+ "13": { class_type: "CLIPLoader", inputs: { clip_name: "umt5_xxl_fp8_e4m3fn_scaled.safetensors", type: "wan" } },
+ "14": { class_type: "VAELoader", inputs: { vae_name: VIDEO_VAE } },
+ "15": { class_type: "VAELoader", inputs: { vae_name: "minimax_h3_audio_vae_fp32.safetensors" } },
+ "16": { class_type: "LoraLoaderModelOnly", inputs: { model: ["12", 0], lora_name: "h3_lightx2v_4step.safetensors", strength_model: 1 } },
+ };
+ const URL_OF = "https://huggingface.co/Kijai/MiniMax-H3-experimental/resolve/f5c3b1d5a63e008a691fca1b6096fd57a5307536/minimax_h3_video_vae_int8_convrot.safetensors";
+
+ it("the reported case: the video VAE named, Download it again, Get the file and Check my GPU, never Retry", () => {
+ const err = { node_id: "14", node_type: "VAELoader", exception_message: LIVE };
+ expect(modelFileProblem(err.node_type, err.exception_message)).toBe("damaged");
+ const files = loaderFiles(err, graph);
+ expect(files).toEqual([VIDEO_VAE]);
+ const d = diagnoseGpuJob({ kind: "error", nodeType: err.node_type, message: err.exception_message, files, fileUrl: URL_OF }, tunnel);
+ expect(d).toMatchObject({
+ cause: "gpu-model-file",
+ words: `A model file on your GPU can't be read: ${VIDEO_VAE}. It's damaged or didn't finish downloading. Download it again, then run.`,
+ retryable: false,
+ });
+ expect(d.actions).toEqual([
+ { kind: "get-file", label: "Get the file", target: URL_OF },
+ { kind: "check-gpu", label: "Check my GPU" },
+ ]);
+ expect(kinds(d)).not.toContain("retry");
+ expect(d.details).toBe(`VAELoader · ${LIVE}`);
+ plain(d);
+ expect(d.words).not.toMatch(/utf-8|codec|0xf7|Traceback/);
+ });
+
+ it("each loader type, and each way a file can't be read", () => {
+ const loaders = ["VAELoader", "UNETLoader", "CheckpointLoaderSimple", "CLIPLoader", "DualCLIPLoader", "LoraLoader", "LoraLoaderModelOnly", "ControlNetLoader", "UpscaleModelLoader", "UnetLoaderGGUF"];
+ const damaged = [
+ LIVE,
+ "invalid load key, '<'.",
+ "Error while deserializing header: HeaderTooLarge",
+ "SafetensorError: Error while deserializing header: MetadataIncompleteBuffer",
+ "safetensors_rust.SafetensorError: incomplete metadata, file not fully covered",
+ "unexpected EOF, expected 1234 more bytes. The file might be corrupted.",
+ "PytorchStreamReader failed reading zip archive: failed finding central directory",
+ "File is not a zip file",
+ ];
+ for (const nodeType of loaders) {
+ for (const message of damaged) {
+ expect(modelFileProblem(nodeType, message), `${nodeType}: ${message}`).toBe("damaged");
+ const d = diagnoseGpuJob({ kind: "error", nodeType, message, files: ["x.safetensors"] }, tunnel);
+ expect(d.cause).toBe("gpu-model-file");
+ expect(d.words).toMatch(/^A model file on your GPU can't be read: x\.safetensors\./);
+ expect(d.retryable).toBe(false);
+ plain(d);
+ }
+ }
+ // The same words from a node that loads no model file, and another loader problem: the add-on's words, as before.
+ expect(modelFileProblem("KSampler", LIVE)).toBeNull();
+ expect(diagnoseGpuJob({ kind: "error", nodeType: "KSampler", message: LIVE }, tunnel).cause).toBe("gpu-job-error");
+ expect(modelFileProblem("VAELoader", "Some other problem")).toBeNull();
+ expect(diagnoseGpuJob({ kind: "error", nodeType: "VAELoader", message: "Some other problem" }, tunnel).cause).toBe("gpu-job-error");
+ // Out of memory while loading a model stays out of memory.
+ expect(diagnoseGpuJob({ kind: "error", nodeType: "UNETLoader", message: "CUDA out of memory. Tried to allocate 2.00 GiB" }, tunnel).cause).toBe("gpu-out-of-memory");
+ });
+
+ it("a file that isn't there says add it; one that can't be read says download it again", () => {
+ for (const message of [
+ "[Errno 2] No such file or directory: '/workspace/ComfyUI/models/vae/minimax_h3_video_vae_int8_convrot.safetensors'",
+ "FileNotFoundError: minimax_h3_video_vae_int8_convrot.safetensors",
+ "Model in folder 'vae' with filename 'minimax_h3_video_vae_int8_convrot.safetensors' not found.",
+ "Value not in list: vae_name: 'minimax_h3_video_vae_int8_convrot.safetensors' not in ['ae.safetensors']",
+ ]) {
+ expect(modelFileProblem("VAELoader", message), message).toBe("missing");
+ const d = diagnoseGpuJob({ kind: "error", nodeType: "VAELoader", message, files: [VIDEO_VAE] }, tunnel);
+ expect(d).toMatchObject({ cause: "gpu-model-file", words: `Your GPU doesn't have the model file ${VIDEO_VAE}. Add it, then run.`, retryable: false });
+ plain(d);
+ }
+ // No file name known: still plain words.
+ expect(diagnoseGpuJob({ kind: "error", nodeType: "VAELoader", message: LIVE }, tunnel).words).toBe("A model file on your GPU can't be read. It's damaged or didn't finish downloading. Download it again, then run.");
+ expect(diagnoseGpuJob({ kind: "error", nodeType: "VAELoader", message: "No such file or directory" }, tunnel).words).toBe("Your GPU doesn't have a model file this needs. Add it, then run.");
+ // Another value not in the list (not a file): not this.
+ expect(modelFileProblem("CLIPLoader", "Value not in list: type: 'wan9' not in ['wan', 'sd3']")).toBeNull();
+ });
+
+ it("finds the file: the failing node's inputs, else what ComfyUI reported, else the error's own words", () => {
+ // By the error's node id: the video VAE, not the audio one beside it.
+ expect(loaderFiles({ node_id: "15", node_type: "VAELoader", exception_message: LIVE }, graph)).toEqual(["minimax_h3_audio_vae_fp32.safetensors"]);
+ // A link to another node is not a file; a LoRA's file is.
+ expect(loaderFiles({ node_id: "16", node_type: "LoraLoaderModelOnly", exception_message: "invalid load key, '<'." }, graph)).toEqual(["h3_lightx2v_4step.safetensors"]);
+ // No graph: the inputs ComfyUI sent with the error (each in a list).
+ expect(loaderFiles({ node_id: "9", node_type: "CheckpointLoaderSimple", exception_message: "invalid load key", current_inputs: { ckpt_name: ["sdxl/juggernaut.safetensors"] } })).toEqual(["sdxl/juggernaut.safetensors"]);
+ // No node id: every node of that class, the one the error names first.
+ expect(loaderFiles({ node_type: "VAELoader", exception_message: `Error while deserializing header: HeaderTooLarge in ${VIDEO_VAE}` }, graph)).toEqual([VIDEO_VAE]);
+ expect(loaderFiles({ node_type: "VAELoader", exception_message: LIVE }, graph)).toEqual([VIDEO_VAE, "minimax_h3_audio_vae_fp32.safetensors"]);
+ // Nothing else: a file the error itself names (its base name, no folder).
+ expect(loaderFiles({ node_type: "UpscaleModelLoader", exception_message: "[Errno 2] No such file or directory: '/models/upscale_models/4x-UltraSharp.pth'" })).toEqual(["4x-UltraSharp.pth"]);
+ expect(loaderFiles({ node_type: "UpscaleModelLoader", exception_message: LIVE })).toEqual([]);
+ expect(isLoaderNode("DualCLIPLoader")).toBe(true);
+ expect(isLoaderNode("KSampler")).toBe(false);
+ });
+
+ it("Get the file only for an https link; Check my GPU only for a GPU at a web address", () => {
+ const base = { kind: "error" as const, nodeType: "VAELoader", message: LIVE, files: [VIDEO_VAE] };
+ expect(kinds(diagnoseGpuJob({ ...base, fileUrl: "http://example.com/x.safetensors" }, tunnel))).toEqual(["check-gpu"]);
+ expect(kinds(diagnoseGpuJob({ ...base, fileUrl: "javascript:alert(1)" }, tunnel))).toEqual(["check-gpu"]);
+ expect(kinds(diagnoseGpuJob({ ...base, fileUrl: URL_OF }, { kind: "computer" }))).toEqual(["get-file"]);
+ expect(kinds(diagnoseGpuJob(base, { kind: "connect" }))).toEqual([]);
+ // The address never reaches the details line; a password it echoed neither.
+ const echoed = diagnoseGpuJob({ ...base, message: `invalid load key at https://quiet-river.trycloudflare.com/x token=abcdef123456` }, tunnel);
+ expect(echoed.details).not.toMatch(/quiet-river|abcdef123456/);
+ // A traceback stays in the details line, on one line.
+ const tb = diagnoseGpuJob({ ...base, message: `${LIVE}\nTraceback (most recent call last):\n File "nodes.py", line 1` }, tunnel);
+ expect(tb.words).not.toMatch(/Traceback/);
+ expect(tb.details).not.toMatch(/\n/);
+ });
+});
+
describe("Your keys: what fal.ai or Replicate said", () => {
const fal = { provider: "fal" as const };
it("a key refused or out of credit is never waited out, and says where to fix it", () => {
diff --git a/tests/own-gpu-graceful.test.ts b/tests/own-gpu-graceful.test.ts
index 1c604035..118a9b9e 100644
--- a/tests/own-gpu-graceful.test.ts
+++ b/tests/own-gpu-graceful.test.ts
@@ -1127,3 +1127,77 @@ describe("a wait survives a restart or a deploy", () => {
}
});
});
+
+describe("a model file its GPU can't read, or doesn't have", () => {
+ // The reported case: MiniMax H3 on an account's own GPU through a tunnel; its VAELoader read a damaged video VAE, and
+ // the tile said "Press Retry" five times.
+ const VAE = "minimax_h3_video_vae_int8_convrot.safetensors";
+ const LIVE = "'utf-8' codec can't decode byte 0xf7 in position 0: invalid start byte";
+ const graph = {
+ "12": { class_type: "UNETLoader", inputs: { unet_name: "minimax_h3_fast_fp8_scaled.safetensors", weight_dtype: "default" } },
+ "13": { class_type: "CLIPLoader", inputs: { clip_name: "umt5_xxl_fp8_e4m3fn_scaled.safetensors", type: "wan" } },
+ "14": { class_type: "VAELoader", inputs: { vae_name: VAE } },
+ "15": { class_type: "VAELoader", inputs: { vae_name: "minimax_h3_audio_vae_fp32.safetensors" } },
+ "16": { class_type: "LoraLoaderModelOnly", inputs: { model: ["12", 0], lora_name: "h3_lightx2v_4step.safetensors", strength_model: 1 } },
+ };
+ /** ComfyUI's history for a job whose node failed with these words (its graph as it was sent). */
+ const failedWith = (nodeId: string, nodeType: string, message: string) => (m: string, p: string) => {
+ if (m !== "GET" || !p.startsWith("/history/")) return undefined;
+ const id = decodeURIComponent(p.slice("/history/".length));
+ const error = { prompt_id: id, node_id: nodeId, node_type: nodeType, executed: [], exception_message: message, exception_type: "UnicodeDecodeError", traceback: [' File "execution.py", line 1'], current_inputs: {}, current_outputs: {} };
+ return { status: 200, contentType: "application/json", body: JSON.stringify({ [id]: { prompt: [1, id, graph, {}, []], status: { status_str: "error", completed: false, messages: [["execution_start", {}], ["execution_error", error]] }, outputs: {} } }) };
+ };
+
+ it("the reported case: the video VAE named, where to get it again, Check my GPU, and never Retry", async () => {
+ fake.opts.answer = failedWith("14", "VAELoader", LIVE);
+ const g = await settle(await startRun());
+ expect(g?.status).toBe("failed");
+ expect(g?.error).toBe(`A model file on your GPU can't be read: ${VAE}. It's damaged or didn't finish downloading. Download it again, then run.`);
+ plainWords(g?.error);
+ expect(g?.trouble?.cause).toBe("gpu-model-file");
+ expect(kinds(g?.trouble)).toEqual(["get-file", "check-gpu"]);
+ // Where the requirement index downloads it from, pinned to its revision.
+ expect(g?.trouble?.actions[0]).toMatchObject({ label: "Get the file", target: expect.stringMatching(/^https:\/\/huggingface\.co\/Kijai\/MiniMax-H3-experimental\/resolve\/[0-9a-f]{40}\/minimax_h3_video_vae_int8_convrot\.safetensors$/) });
+ // ComfyUI's own words stay in the details line.
+ expect(g?.trouble?.details).toBe(`VAELoader · ${LIVE}`);
+ // It isn't sent again by itself: waiting can't mend a file.
+ expect(fake.log.filter((e) => e.path === "/prompt")).toHaveLength(1);
+ expect(ownRunNote(g!.id)).toMatchObject({ cause: "gpu-model-file", stage: "poll" });
+ });
+
+ it("a file its ComfyUI doesn't have: add it, then run", async () => {
+ fake.opts.answer = failedWith("12", "UNETLoader", "[Errno 2] No such file or directory: '/workspace/ComfyUI/models/diffusion_models/minimax_h3_fast_fp8_scaled.safetensors'");
+ const g = await settle(await startRun());
+ expect(g?.error).toBe("Your GPU doesn't have the model file minimax_h3_fast_fp8_scaled.safetensors. Add it, then run.");
+ expect(g?.trouble?.cause).toBe("gpu-model-file");
+ expect(kinds(g?.trouble)).not.toContain("retry");
+ });
+
+ it("a file outside the workflow's list that its loader doesn't list: refused before it runs, named", async () => {
+ const file = "my_own_vae_v2.safetensors";
+ fake.opts.answer = (m, p) =>
+ m === "POST" && p === "/prompt"
+ ? {
+ status: 400,
+ contentType: "application/json",
+ body: JSON.stringify({
+ error: { type: "prompt_outputs_failed_validation", message: "Prompt outputs failed validation" },
+ node_errors: { "14": { class_type: "VAELoader", errors: [{ type: "value_not_in_list", message: "Value not in list", details: `vae_name: '${file}' not in ['ae.safetensors']`, extra_info: { input_name: "vae_name", received_value: file } }] } },
+ }),
+ }
+ : undefined;
+ const g = await settle(await startRun());
+ expect(g?.status).toBe("failed");
+ expect(g?.error).toBe(`Your GPU doesn't have the model file ${file}. Add it, then run.`);
+ expect(g?.trouble?.cause).toBe("gpu-model-file");
+ expect(kinds(g?.trouble)).not.toContain("retry");
+ expect(g?.trouble?.details).toMatch(/^VAELoader · Value not in list: vae_name: 'my_own_vae_v2\.safetensors' not in/);
+ });
+
+ it("another node with the same words keeps the add-on's words and Retry", async () => {
+ fake.opts.answer = failedWith("20", "KSampler", LIVE);
+ const g = await settle(await startRun());
+ expect(g?.trouble?.cause).toBe("gpu-job-error");
+ expect(g?.error).toBe("Your GPU hit a problem while making this. Press Retry, or update your add-ons.");
+ });
+});
diff --git a/tests/own-graceful-ui.test.ts b/tests/own-graceful-ui.test.ts
index 6fd79221..7924ad8e 100644
--- a/tests/own-graceful-ui.test.ts
+++ b/tests/own-graceful-ui.test.ts
@@ -19,7 +19,7 @@ const { failedRunHandlers, movingRun, reuseHref, studioHrefFor, waitingRunHandle
const { RunTroubleActions } = await import("@/components/gpu/run-trouble-actions");
const { StatusCover } = await import("@/components/library/asset-card");
type RunTroubleDeps = import("@/lib/run-trouble").RunTroubleDeps;
-const { diagnoseGpu, RUNPOD_CONSOLE_URL, troubleOf, withKeyAction, withOfferAfterFirst } = await import("@/lib/diagnose");
+const { diagnoseGpu, diagnoseGpuJob, RUNPOD_CONSOLE_URL, troubleOf, withKeyAction, withOfferAfterFirst } = await import("@/lib/diagnose");
const { getModel, getPreset } = await import("@/lib/catalog");
const { TroubleActions, TroubleDetails, autoCheckIn, fitActions } = await import("@/components/gpu/trouble");
const { FailedTile } = await import("@/components/studio/feed");
@@ -139,6 +139,29 @@ describe("the buttons", () => {
expect(html).toContain(end.words.replaceAll("'", "&#x27;"));
});
+ it("a model file its GPU can't read: the tile and the Library card name it, with Get the file (a new tab) and Check my GPU", () => {
+ const VAE = "minimax_h3_video_vae_int8_convrot.safetensors";
+ const url = "https://huggingface.co/Kijai/MiniMax-H3-experimental/resolve/f5c3b1d5a63e008a691fca1b6096fd57a5307536/minimax_h3_video_vae_int8_convrot.safetensors";
+ const d = diagnoseGpuJob({ kind: "error", nodeType: "VAELoader", message: "'utf-8' codec can't decode byte 0xf7 in position 0: invalid start byte", files: [VAE], fileUrl: url }, { kind: "link", url: "https://quiet-river.trycloudflare.com" });
+ const g = { id: "g-vae", status: "failed", error: d.words, trouble: troubleOf(d), outputs: [], createdAt: Date.now(), request: { feature: "video", modelId: "oss-minimax-h3", prompt: "" }, feature: "video", kind: "video", modelId: "oss-minimax-h3", op: "t2v" };
+ for (const html of [render(createElement(FailedTile, { g: g as never, ratio: 16 / 9, onRetry: () => {} })), render(createElement(StatusCover, { g: g as never, actionable: true }))]) {
+ expect(html).toContain(VAE);
+ expect(html).toContain("Download it again, then run.");
+ expect(html).toContain(`href="${url}"`);
+ expect(html).toContain('target="_blank"');
+ expect(html).toContain('rel="noopener noreferrer"');
+ expect(html).toContain("Get the file");
+ expect(html).toContain("Check my GPU");
+ expect(html).toContain("VAELoader · &#x27;utf-8&#x27; codec");
+ }
+ // Get the file leads (the button that helps most).
+ expect(fitActions(d.actions, 1).map((a) => a.kind)).toEqual(["get-file"]);
+ // Only an https link is drawn.
+ const plainHttp = render(createElement(TroubleActions, { actions: [{ kind: "get-file", label: "Get the file", target: "http://example.com/x.safetensors" }, { kind: "check-gpu", label: "Check my GPU" }] }));
+ expect(plainHttp).not.toContain("Get the file");
+ expect(render(createElement(TroubleActions, { actions: [{ kind: "get-file", label: "Get the file", target: "javascript:alert(1)" }] }))).toBe("");
+ });
+
it("the details line is small and only there when there is something to say", () => {
expect(render(createElement(TroubleDetails, { details: "RunPod pod, port 8188 · HTTP 404" }))).toContain("HTTP 404");
expect(render(createElement(TroubleDetails, {}))).toBe("");