Skip to content

The all-in-one local AI studio for your desktop: chat, image and video generation and a coding agent in one free, open source app. Windows and Linux. No Docker, no terminal, no cloud required.

fix(create): Cutout installs a ComfyUI-RMBG commit that loads on Windows

purple101b44682578
diff --git a/dev-server/comfy.ts b/dev-server/comfy.ts
index ff6995a8..eb103447 100644
--- a/dev-server/comfy.ts
+++ b/dev-server/comfy.ts
@@ -310,6 +310,11 @@ export function registerComfyInstallRoutes(routes: RouteMount, comfy: ComfyLaunc
console.log(`[CustomNode] Installing ${nodeName} from ${repoUrl}...`)
try {
execFileSync('git', ['clone', repoUrl, targetDir], { timeout: 120000 })
+ // A pinned pack goes onto its tested commit (model-bundles.ts).
+ const commit = bodyString(body, 'commit') ?? ''
+ if (/^[0-9a-f]{40}$/i.test(commit)) {
+ execFileSync('git', ['checkout', '--detach', commit], { cwd: targetDir, timeout: 60000 })
+ }
// Try pip install if requirements.txt exists
const reqFile = join(targetDir, 'requirements.txt')
if (existsSync(reqFile)) {
diff --git a/src-tauri/src/commands/install/custom_nodes.rs b/src-tauri/src/commands/install/custom_nodes.rs
index 6f9d7d0e..a790028e 100644
--- a/src-tauri/src/commands/install/custom_nodes.rs
+++ b/src-tauri/src/commands/install/custom_nodes.rs
@@ -53,6 +53,7 @@ pub async fn install_custom_node(
app: tauri::AppHandle,
repoUrl: String,
nodeName: String,
+ commit: Option<String>,
) -> Result<serde_json::Value, String> {
// Snapshot the state the blocking worker needs before spawning it: a Tauri
// `State` (and the MutexGuard behind it) is not Send, so clone the values
@@ -86,7 +87,7 @@ pub async fn install_custom_node(
}
},
};
- install_custom_node_blocking(repoUrl, nodeName, comfy_path, &fallback_python, &pause)
+ install_custom_node_blocking(repoUrl, nodeName, commit, comfy_path, &fallback_python, &pause)
})
.await
.map_err(|e| format!("Custom node install task failed to run: {e}"))?
@@ -99,6 +100,7 @@ pub async fn install_custom_node(
fn install_custom_node_blocking(
repoUrl: String,
nodeName: String,
+ commit: Option<String>,
comfy_path: Option<String>,
fallback_python: &str,
pause: &ComfyPause<'_>,
@@ -131,6 +133,13 @@ fn install_custom_node_blocking(
{
return Err("Refusing to install: invalid custom-node name.".to_string());
}
+ // A pin is a full commit id and nothing else: it ends up as a git
+ // argument, and a branch name or a leading `-` has no business there.
+ if let Some(c) = &commit {
+ if !is_full_commit_id(c) {
+ return Err("Refusing to install: the pinned commit must be a full 40 character commit id.".to_string());
+ }
+ }
info!(node = %node_name, "custom node install start");
@@ -194,21 +203,29 @@ fn install_custom_node_blocking(
if target_dir.exists() {
if target_dir.join(".git").exists() {
println!("[Install] Custom node {} already exists, updating...", node_name);
- let mut cmd = crate::process_util::foreign_system_command("git");
- cmd.args(["pull"]).current_dir(&target_dir)
- .stdout(Stdio::piped()).stderr(Stdio::piped());
- #[cfg(target_os = "windows")]
- cmd.creation_flags(CREATE_NO_WINDOW);
- let output = cmd.output()
- .map_err(|e| format!("Git pull failed: {}", os_error::english(&e)))?;
- if !output.status.success() {
- let stderr = String::from_utf8_lossy(&output.stderr);
- error!(node = %node_name, "custom node git pull failed");
- return Err(format!(
- "Failed to update {} (git pull): {}\n\nIf this keeps failing, \
+ // A pinned pack is set to its commit further down and never
+ // pulled: a pull is exactly what brings in the newer state the
+ // pin is there to keep out.
+ if commit.is_none() {
+ // A checkout that sat on a pin has no branch to pull into.
+ // This is how a pin is released: take it out of the registry
+ // and the next install is back on the default branch.
+ return_to_default_branch(&target_dir).map_err(|e| format!(
+ "Failed to update {} (git checkout): {}\n\nIf this keeps failing, \
delete the folder {} and try the install again.",
- node_name, stderr.trim(), target_dir.to_string_lossy()
- ));
+ node_name, e, target_dir.to_string_lossy()
+ ))?;
+ let output = git_in(&target_dir, &["pull"])
+ .map_err(|e| format!("Git pull failed: {e}"))?;
+ if !output.status.success() {
+ let stderr = String::from_utf8_lossy(&output.stderr);
+ error!(node = %node_name, "custom node git pull failed");
+ return Err(format!(
+ "Failed to update {} (git pull): {}\n\nIf this keeps failing, \
+ delete the folder {} and try the install again.",
+ node_name, stderr.trim(), target_dir.to_string_lossy()
+ ));
+ }
}
fresh_clone = false;
} else {
@@ -238,6 +255,20 @@ fn install_custom_node_blocking(
}
}
+ // Fresh clone or a checkout that was already there: a pinned pack ends up
+ // on its commit either way, so a clone that ran ahead of the pin (every
+ // install before the pin existed) is set back by the same click.
+ if let Some(c) = &commit {
+ checkout_pinned_commit(&target_dir, c).map_err(|e| {
+ error!(node = %node_name, "custom node pin checkout failed");
+ format!(
+ "Failed to set {} to its tested version (git checkout): {}\n\nIf this keeps failing, \
+ delete the folder {} and try the install again.",
+ node_name, e, target_dir.to_string_lossy()
+ )
+ })?;
+ }
+
// A node pack never replaces torch: its requirements go in against a pin
// of the torch family this ComfyUI runs on, so a pack that asks for
// another torch fails by name instead of trading the CUDA build for a
@@ -260,6 +291,59 @@ fn install_custom_node_blocking(
}))
}
+/// A full, lowercase or uppercase, 40 character hexadecimal commit id.
+fn is_full_commit_id(s: &str) -> bool {
+ s.len() == 40 && s.bytes().all(|b| b.is_ascii_hexdigit())
+}
+
+/// One git call inside a node pack's checkout, output captured, no console
+/// window on Windows.
+fn git_in(dir: &std::path::Path, args: &[&str]) -> Result<std::process::Output, String> {
+ let mut cmd = crate::process_util::foreign_system_command("git");
+ cmd.args(args).current_dir(dir).stdout(Stdio::piped()).stderr(Stdio::piped());
+ #[cfg(target_os = "windows")]
+ cmd.creation_flags(CREATE_NO_WINDOW);
+ cmd.output().map_err(|e| os_error::english(&e))
+}
+
+/// `git_in`, where anything but success is the error text git printed.
+fn git_ok(dir: &std::path::Path, args: &[&str]) -> Result<String, String> {
+ let output = git_in(dir, args)?;
+ if !output.status.success() {
+ return Err(String::from_utf8_lossy(&output.stderr).trim().to_string());
+ }
+ Ok(String::from_utf8_lossy(&output.stdout).trim().to_string())
+}
+
+/// Put a node pack's checkout on the commit the registry pins it to.
+///
+/// The box, 03.10.2026, ComfyUI-RMBG: the pack's head of 30.09.2026 no longer
+/// loads on Windows, and the installer cloned whatever the head was. A pinned
+/// pack is set to a commit that was seen loading instead. Nothing is fetched
+/// when the commit is already there, so a second click works offline.
+fn checkout_pinned_commit(target_dir: &std::path::Path, commit: &str) -> Result<(), String> {
+ if git_ok(target_dir, &["rev-parse", "HEAD"]).is_ok_and(|head| head.eq_ignore_ascii_case(commit)) {
+ return Ok(());
+ }
+ let object = format!("{commit}^{{commit}}");
+ if git_ok(target_dir, &["cat-file", "-e", &object]).is_err() {
+ git_ok(target_dir, &["fetch", "origin"])?;
+ }
+ git_ok(target_dir, &["checkout", "--detach", commit]).map(|_| ())
+}
+
+/// Bring a checkout that sits on a bare commit back onto the default branch
+/// of its origin, so that a pull has a branch to update. A checkout that is
+/// on a branch already is left alone.
+fn return_to_default_branch(target_dir: &std::path::Path) -> Result<(), String> {
+ if git_ok(target_dir, &["symbolic-ref", "-q", "HEAD"]).is_ok() {
+ return Ok(());
+ }
+ let remote_head = git_ok(target_dir, &["rev-parse", "--abbrev-ref", "origin/HEAD"])?;
+ let branch = remote_head.strip_prefix("origin/").unwrap_or(&remote_head);
+ git_ok(target_dir, &["checkout", branch]).map(|_| ())
+}
+
/// How the installer takes this app's own ComfyUI out of the way and brings
/// it back. Closures, so the rule below is provable without a process.
pub(crate) struct ComfyPause<'a> {
@@ -768,6 +852,109 @@ mod tests {
assert!(body.contains("&TORCH_PACKAGES"), "the install no longer pins torch");
}
+ // ── A pinned node pack (the box, 03.10.2026, ComfyUI-RMBG) ──────────
+
+ fn test_git(dir: &std::path::Path, args: &[&str]) -> String {
+ let mut all = vec!["-c", "user.name=t", "-c", "[email protected]", "-c", "commit.gpgsign=false"];
+ all.extend_from_slice(args);
+ git_ok(dir, &all).unwrap_or_else(|e| panic!("git {args:?} failed: {e}"))
+ }
+
+ /// An origin with two commits and a clone of it that sits on the newer
+ /// one, the state every install before the pin left behind. Returns the
+ /// temp dir, the clone and the two commit ids, older first.
+ fn origin_and_clone() -> (tempfile::TempDir, PathBuf, String, String) {
+ let tmp = tempfile::tempdir().unwrap();
+ let origin = tmp.path().join("origin");
+ std::fs::create_dir(&origin).unwrap();
+ test_git(&origin, &["init", "-b", "main"]);
+ std::fs::write(origin.join("node.py"), "good").unwrap();
+ test_git(&origin, &["add", "."]);
+ test_git(&origin, &["commit", "-m", "good"]);
+ let good = test_git(&origin, &["rev-parse", "HEAD"]);
+ std::fs::write(origin.join("node.py"), "broken").unwrap();
+ test_git(&origin, &["commit", "-am", "broken"]);
+ let broken = test_git(&origin, &["rev-parse", "HEAD"]);
+ let clone = tmp.path().join("clone");
+ test_git(tmp.path(), &["clone", &origin.to_string_lossy(), &clone.to_string_lossy()]);
+ (tmp, clone, good, broken)
+ }
+
+ #[test]
+ fn a_clone_that_ran_ahead_is_set_back_to_the_pinned_commit() {
+ let (_tmp, clone, good, broken) = origin_and_clone();
+ assert_eq!(test_git(&clone, &["rev-parse", "HEAD"]), broken);
+
+ checkout_pinned_commit(&clone, &good).unwrap();
+
+ assert_eq!(test_git(&clone, &["rev-parse", "HEAD"]), good);
+ assert_eq!(std::fs::read_to_string(clone.join("node.py")).unwrap(), "good");
+ // A second click finds the pin in place and has nothing to do.
+ checkout_pinned_commit(&clone, &good).unwrap();
+ assert_eq!(test_git(&clone, &["rev-parse", "HEAD"]), good);
+ }
+
+ #[test]
+ fn a_pin_the_clone_has_not_seen_yet_is_fetched_first() {
+ let (tmp, clone, _good, _broken) = origin_and_clone();
+ let origin = tmp.path().join("origin");
+ std::fs::write(origin.join("node.py"), "fixed").unwrap();
+ test_git(&origin, &["commit", "-am", "fixed"]);
+ let fixed = test_git(&origin, &["rev-parse", "HEAD"]);
+
+ checkout_pinned_commit(&clone, &fixed).unwrap();
+
+ assert_eq!(std::fs::read_to_string(clone.join("node.py")).unwrap(), "fixed");
+ }
+
+ #[test]
+ fn a_pin_that_does_not_exist_is_an_error_and_leaves_the_checkout_alone() {
+ let (_tmp, clone, _good, broken) = origin_and_clone();
+ let err = checkout_pinned_commit(&clone, "0123456789012345678901234567890123456789").unwrap_err();
+ assert!(!err.is_empty());
+ assert_eq!(test_git(&clone, &["rev-parse", "HEAD"]), broken);
+ }
+
+ #[test]
+ fn a_released_pin_goes_back_to_the_default_branch_and_pulls_again() {
+ let (_tmp, clone, good, broken) = origin_and_clone();
+ checkout_pinned_commit(&clone, &good).unwrap();
+ assert!(git_ok(&clone, &["symbolic-ref", "-q", "HEAD"]).is_err(), "the pin leaves no branch checked out");
+
+ return_to_default_branch(&clone).unwrap();
+
+ assert_eq!(test_git(&clone, &["symbolic-ref", "--short", "HEAD"]), "main");
+ test_git(&clone, &["pull"]);
+ assert_eq!(test_git(&clone, &["rev-parse", "HEAD"]), broken);
+ // On a branch already: nothing to do, and no error.
+ return_to_default_branch(&clone).unwrap();
+ }
+
+ #[test]
+ fn only_a_full_commit_id_is_a_pin() {
+ assert!(is_full_commit_id("58f1947a11567a9f8b707223185570850e773856"));
+ assert!(!is_full_commit_id("58f1947"));
+ assert!(!is_full_commit_id("main"));
+ assert!(!is_full_commit_id("--upload-pack=touch /tmp/x; aaaaaaaaaaaaaaaa"));
+ assert!(!is_full_commit_id("58f1947a11567a9f8b707223185570850e77385g"));
+ }
+
+ /// Source guard: the pin is worth nothing if the command pulls a pinned
+ /// pack forward or never runs the checkout.
+ #[test]
+ fn install_custom_node_sets_a_pinned_pack_to_its_commit_and_never_pulls_it() {
+ let src = include_str!("custom_nodes.rs");
+ let start = src.find("fn install_custom_node_blocking(").expect("install_custom_node_blocking is gone");
+ let body = &src[start..];
+ let body = &body[..body.find("\n}\n").expect("install_custom_node_blocking has no end")];
+ let at_guard = body.find("if commit.is_none() {").expect("the pull is no longer skipped for a pinned pack");
+ let at_pull = body.find("\"pull\"").expect("the pull is gone");
+ assert!(at_guard < at_pull, "the pull must sit inside the unpinned branch");
+ let at_pin = body.find("checkout_pinned_commit(").expect("a pinned pack is no longer set to its commit");
+ let at_reqs = body.find("install_requirements_freeing_locked_files(").expect("the requirements install is gone");
+ assert!(at_pin < at_reqs, "the requirements must be the pinned commit's, so the checkout comes first");
+ }
+
// ── install_custom_node helpers (#72 bob: VHS install loop) ─────────
#[test]
diff --git a/src/api/__tests__/custom-node-install.test.ts b/src/api/__tests__/custom-node-install.test.ts
index c14d9119..acbdb1b1 100644
--- a/src/api/__tests__/custom-node-install.test.ts
+++ b/src/api/__tests__/custom-node-install.test.ts
@@ -16,6 +16,7 @@ vi.mock('../backend', async () => {
import { backendCall } from '../backend'
import { installCustomNodes, assertNodeInstallOk } from '../discover'
+import { CUSTOM_NODE_REGISTRY } from '../model-bundles'
const mockedCall = vi.mocked(backendCall)
@@ -65,4 +66,19 @@ describe('installCustomNodes (#72)', () => {
await expect(installCustomNodes(['videohelpersuite']))
.rejects.toThrow(/network down/)
})
+
+ // The box, 03.10.2026: the head of ComfyUI-RMBG stopped loading on Windows.
+ // The registry pins the pack to a commit that was seen loading, and the pin
+ // has to reach the installer.
+ it('sends the pinned commit of a pinned pack', async () => {
+ mockedCall.mockResolvedValue({ status: 'updated', path: 'C:/x' })
+
+ await installCustomNodes(['rmbg'])
+ expect(CUSTOM_NODE_REGISTRY.rmbg.commit).toMatch(/^[0-9a-f]{40}$/)
+ expect(mockedCall).toHaveBeenCalledWith('install_custom_node', {
+ repoUrl: 'https://github.com/1038lab/ComfyUI-RMBG',
+ nodeName: 'ComfyUI-RMBG',
+ commit: CUSTOM_NODE_REGISTRY.rmbg.commit,
+ })
+ })
})
diff --git a/src/api/discover.ts b/src/api/discover.ts
index fac5760d..b9c20e68 100644
--- a/src/api/discover.ts
+++ b/src/api/discover.ts
@@ -574,7 +574,9 @@ export async function installCustomNodes(nodeKeys: string[], opts: CustomNodeIns
}
try {
opts.onProgress?.(`Installing ${entry.name}…`)
- const result = await backendCall('install_custom_node', { repoUrl: entry.repo, nodeName: entry.name })
+ const result = await backendCall('install_custom_node', {
+ repoUrl: entry.repo, nodeName: entry.name, ...(entry.commit ? { commit: entry.commit } : {}),
+ })
assertNodeInstallOk(result, entry.name)
log.info(`[discover] Installed custom node: ${entry.name}`)
} catch (err) {
diff --git a/src/api/model-bundles.ts b/src/api/model-bundles.ts
index d2a4e0f6..78d25dc1 100644
--- a/src/api/model-bundles.ts
+++ b/src/api/model-bundles.ts
@@ -753,7 +753,22 @@ export interface CustomNodeDef {
name: string
}
-export const CUSTOM_NODE_REGISTRY: Record<string, { repo: string; name: string; requiredNodes: string[] }> = {
+export interface CustomNodeEntry {
+ repo: string
+ name: string
+ requiredNodes: string[]
+ /**
+ * A tested commit of the pack. The installer puts the checkout on exactly
+ * this commit (fresh clone or one that is already there) instead of the
+ * head of the repository. Only for a pack whose head was seen broken, with
+ * the date and the reason next to it. To release a pin, delete the field:
+ * the next install goes back to the default branch and pulls
+ * (custom_nodes.rs, return_to_default_branch).
+ */
+ commit?: string
+}
+
+export const CUSTOM_NODE_REGISTRY: Record<string, CustomNodeEntry> = {
'animatediff-evolved': {
repo: 'https://github.com/Kosinkadink/ComfyUI-AnimateDiff-Evolved',
name: 'ComfyUI-AnimateDiff-Evolved',
@@ -796,10 +811,21 @@ export const CUSTOM_NODE_REGISTRY: Record<string, { repo: string; name: string;
// for · and auto-downloads its cutout model (BiRefNet / RMBG-2.0, ~300 MB)
// into ComfyUI/models/RMBG on first use. So the one-click action only needs to
// install the node; the model lands on the first cutout run.
+ //
+ // Pinned on 03.10.2026 to 58f1947a (21.08.2026, pack version 3.1.0), the last
+ // commit before the pack's 3.2.0 uploads of 30.09.2026. From 54e62337 on,
+ // the pack's own loader dies on the first node file that fails to import
+ // (its error line names a variable that does not exist), and on Windows one
+ // always fails: the SAM3 node imports triton, which exists for Linux only.
+ // ComfyUI then reports IMPORT FAILED for the whole pack and no RMBG node.
+ // Measured on the Windows box: head 229529e0 does not load, 58f1947a lists
+ // RMBG. Release the pin (delete `commit`) once the pack's head loads again
+ // on Windows with no triton installed.
'rmbg': {
repo: 'https://github.com/1038lab/ComfyUI-RMBG',
name: 'ComfyUI-RMBG',
requiredNodes: ['RMBG'],
+ commit: '58f1947a11567a9f8b707223185570850e773856',
},
// GGUF quant loader (city96). Lets the 2.5.8 lanes offer Q4 quants of the
// 14B Wan models (S2V / Animate / NSFW finetunes) — the difference between
diff --git a/src/components/create/experimental/CreateContext.tsx b/src/components/create/experimental/CreateContext.tsx
index 6dc41e3c..3f2f6815 100644
--- a/src/components/create/experimental/CreateContext.tsx
+++ b/src/components/create/experimental/CreateContext.tsx
@@ -6,6 +6,7 @@ import { useCreateStore, type GalleryItem } from '../../../stores/createStore'
import { listedLoras, getVAEModels, checkComfyConnection, refreshComfyModels, bundleForVideoIntent } from '../../../api/comfyui'
import { getAllNodeInfo, clearNodeCache } from '../../../api/comfyui-nodes'
import { installCustomNodes, getImageBundles, getVideoBundles, getAudioBundles, getLipsyncBundles, getMotionBundles, startModelDownload, getDownloadProgress, modelsNotVisibleInComfy, judgeableFolders } from '../../../api/discover'
+import { CUSTOM_NODE_REGISTRY } from '../../../api/model-bundles'
import { backendCall, isMacOS, isLinux } from '../../../api/backend'
import { asComfyGpuMode, comfyCpuBannerText, type ComfyCpuBannerFacts } from '../../../lib/comfy-cpu-banner'
import { installMlxStack } from '../../../api/mlx-install'
@@ -13,7 +14,7 @@ import { useDownloadStore } from '../../../stores/downloadStore'
import { downloadBundleFiles, waitOrAbort, waitForModelsVisible, InstallCancelled } from '../../../lib/bundle-install'
import { ensureLocalFilename } from './loadImage'
import { batchReady, requestBatchStop, runBatchEdit } from './batchRun'
-import { comfyStartupError, COMFY_INSTALLED_BUT_DEAD } from './comfyError'
+import { comfyStartupError, nodePackLoadError, COMFY_INSTALLED_BUT_DEAD } from './comfyError'
import { restartComfyForNewNodes } from '../../../api/comfy-restart'
import type { CloudQuota } from '../../../lib/render/cloud-jobs'
@@ -406,10 +407,8 @@ export function CreateExpProvider({ children }: { children: ReactNode }) {
}
} catch { /* ComfyUI still restarting — keep polling */ }
}
- throw new Error(
- `Installed ${pack} and restarted ComfyUI, but it still isn't listing the ${nodeClass} node. ` +
- 'Open the Model Manager to finish the install, or check the ComfyUI console for a pip error.',
- )
+ const out = await backendCall<{ lines?: string[] }>('comfyui_last_output').catch(() => null)
+ throw new Error(nodePackLoadError(CUSTOM_NODE_REGISTRY[pack].name, nodeClass, out?.lines))
}, [setCaps, ensureComfyRunning])
// One-click starter models for a fresh PC: ensure ComfyUI, then pull the
diff --git a/src/components/create/experimental/__tests__/comfy-startup-error.test.ts b/src/components/create/experimental/__tests__/comfy-startup-error.test.ts
index 36f79e94..da610aad 100644
--- a/src/components/create/experimental/__tests__/comfy-startup-error.test.ts
+++ b/src/components/create/experimental/__tests__/comfy-startup-error.test.ts
@@ -6,6 +6,8 @@ import {
COMFY_INSTALLED_BUT_DEAD,
COMFY_START_FAILED,
comfyStartThrowText,
+ nodePackImportFailure,
+ nodePackLoadError,
} from '../comfyError'
// GH #98: "did not come up" used to be a dead end. The error must carry the
@@ -159,3 +161,50 @@ describe('comfyStartThrowText', () => {
expect(comfyStartupError(COMFY_START_FAILED, [deutsch])).toContain(deutsch)
})
})
+
+// The box, 03.10.2026: ComfyUI-RMBG was installed and ComfyUI still had no
+// RMBG node. The message pointed at "the ComfyUI console"; these are the lines
+// that console held, as ComfyUI printed them.
+describe('a node pack ComfyUI could not load', () => {
+ const lines = [
+ "ModuleNotFoundError: No module named 'accelerate'",
+ "\u001b[1m\u001b[33m[WARNING]\u001b[0m Cannot import C:\\Users\\d\\ComfyUI\\custom_nodes\\ComfyUI-FramePackWrapper module for custom nodes: No module named 'accelerate'",
+ "ModuleNotFoundError: No module named 'triton'",
+ "NameError: name 'module_name' is not defined",
+ "\u001b[1m\u001b[33m[WARNING]\u001b[0m Cannot import C:\\Users\\d\\ComfyUI\\custom_nodes\\ComfyUI-RMBG module for custom nodes: name 'module_name' is not defined",
+ 'Import times for custom nodes:',
+ '\u001b[32m[INFO]\u001b[0m 0.0 seconds (IMPORT FAILED): C:\\Users\\d\\ComfyUI\\custom_nodes\\ComfyUI-FramePackWrapper',
+ '\u001b[32m[INFO]\u001b[0m 4.9 seconds (IMPORT FAILED): C:\\Users\\d\\ComfyUI\\custom_nodes\\ComfyUI-RMBG',
+ ]
+
+ it('names the reason ComfyUI gave for this pack, not for another one', () => {
+ expect(nodePackImportFailure(lines, 'ComfyUI-RMBG')).toBe(
+ "Cannot import C:\\Users\\d\\ComfyUI\\custom_nodes\\ComfyUI-RMBG module for custom nodes: name 'module_name' is not defined",
+ )
+ })
+
+ it('falls back to the IMPORT FAILED line when the reason has scrolled out', () => {
+ expect(nodePackImportFailure(lines.slice(5), 'ComfyUI-RMBG')).toBe(
+ '[INFO] 4.9 seconds (IMPORT FAILED): C:\\Users\\d\\ComfyUI\\custom_nodes\\ComfyUI-RMBG',
+ )
+ })
+
+ it('is empty when ComfyUI said nothing about the pack', () => {
+ expect(nodePackImportFailure(lines, 'ComfyUI-GGUF')).toBe('')
+ expect(nodePackImportFailure(undefined, 'ComfyUI-RMBG')).toBe('')
+ })
+
+ it('puts that line into the message instead of sending the user to a console', () => {
+ const msg = nodePackLoadError('ComfyUI-RMBG', 'RMBG', lines)
+ expect(msg).toContain("name 'module_name' is not defined")
+ expect(msg).not.toMatch(/console/i)
+ expect(msg).not.toContain('\u001b')
+ })
+
+ it('says so when there is no such line, and names a step the app has', () => {
+ const msg = nodePackLoadError('ComfyUI-RMBG', 'RMBG', [])
+ expect(msg).toContain("still isn't listing the RMBG node")
+ expect(msg).toContain('Settings, AI Backends')
+ expect(msg).not.toMatch(/console|Model Manager/i)
+ })
+})
diff --git a/src/components/create/experimental/comfyError.ts b/src/components/create/experimental/comfyError.ts
index 992aedfc..b1c1f4a9 100644
--- a/src/components/create/experimental/comfyError.ts
+++ b/src/components/create/experimental/comfyError.ts
@@ -64,3 +64,32 @@ export function comfyStartThrowText(
if (!advice || base.includes(advice)) return base
return `${base}\n\n${advice}`
}
+
+/** What ComfyUI itself printed about a node pack it could not load.
+ *
+ * ComfyUI writes two lines for such a pack at startup: "Cannot import
+ * <folder> module for custom nodes: <reason>", and further down, in its list
+ * of import times, "<n> seconds (IMPORT FAILED): <folder>". The first carries
+ * the reason, so it wins; the second is the fallback. Colour codes and the
+ * log prefix are dropped. Empty when ComfyUI said nothing about the pack. */
+export function nodePackImportFailure(lines: string[] | undefined, packName: string): string {
+ // eslint-disable-next-line no-control-regex
+ const plain = (lines ?? []).map((l) => l.replace(/\u001b\[[0-9;]*m/g, '').trim())
+ const about = plain.filter((l) => l.includes(packName))
+ const reason = about.filter((l) => l.includes('Cannot import')).pop()
+ if (reason) return reason.slice(reason.indexOf('Cannot import'))
+ return about.filter((l) => l.includes('(IMPORT FAILED)')).pop() ?? ''
+}
+
+/** The error of a node pack that was installed and still did not register its
+ * node (the box, 03.10.2026, ComfyUI-RMBG). It used to send the user to "the
+ * ComfyUI console", which the shipped app does not have. It now carries the
+ * line ComfyUI printed, read from the same buffer the startup errors use. */
+export function nodePackLoadError(packName: string, nodeClass: string, lines?: string[]): string {
+ const failure = nodePackImportFailure(lines, packName)
+ if (failure) {
+ return `ComfyUI could not load ${packName}, so the ${nodeClass} node is missing. ComfyUI reported: ${failure}`
+ }
+ return `Installed ${packName} and restarted ComfyUI, but it still isn't listing the ${nodeClass} node, ` +
+ 'and ComfyUI printed no import error for it. Restart ComfyUI under Settings, AI Backends, then try again.'
+}