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: FLUX 2 generation — use Qwen encoder, fix error parsing

PurpleDoubleD7edc81112499
diff --git a/src-tauri/src/commands/agent.rs b/src-tauri/src/commands/agent.rs
index 5e415866..75260b54 100644
--- a/src-tauri/src/commands/agent.rs
+++ b/src-tauri/src/commands/agent.rs
@@ -53,8 +53,7 @@ pub fn execute_code(
.stdin(Stdio::null())
.stdout(Stdio::piped())
.stderr(Stdio::piped());
- #[cfg(target_os = "windows")]
- cmd.creation_flags(CREATE_NO_WINDOW);
+ // Piped stderr already hides console; CREATE_NO_WINDOW breaks Python stderr
let mut child = cmd.spawn()
.map_err(|e| format!("Spawn Python: {}", e))?;
diff --git a/src-tauri/src/commands/process.rs b/src-tauri/src/commands/process.rs
index 80e728a2..d1283996 100644
--- a/src-tauri/src/commands/process.rs
+++ b/src-tauri/src/commands/process.rs
@@ -225,8 +225,8 @@ pub fn start_comfyui(state: State<'_, AppState>) -> Result<serde_json::Value, St
.stdin(Stdio::null())
.stdout(Stdio::piped())
.stderr(Stdio::piped());
- #[cfg(target_os = "windows")]
- cmd.creation_flags(CREATE_NO_WINDOW);
+ // Note: DO NOT use CREATE_NO_WINDOW for ComfyUI — tqdm needs a valid stderr handle.
+ // Piped stdout/stderr already hides the console window.
let mut child = cmd.spawn()
.map_err(|e| format!("Failed to start ComfyUI (python={}): {}", python, e))?;
@@ -415,8 +415,7 @@ pub fn auto_start_comfyui(state: &AppState) {
.stdin(Stdio::null())
.stdout(Stdio::piped())
.stderr(Stdio::piped());
- #[cfg(target_os = "windows")]
- cmd.creation_flags(CREATE_NO_WINDOW);
+ // Note: DO NOT use CREATE_NO_WINDOW for ComfyUI — tqdm needs a valid stderr handle.
match cmd.spawn() {
Ok(mut child) => {
// Drain stdout/stderr in background threads to prevent buffer deadlock
diff --git a/src-tauri/src/commands/whisper.rs b/src-tauri/src/commands/whisper.rs
index bf3f2ba9..5eab4849 100644
--- a/src-tauri/src/commands/whisper.rs
+++ b/src-tauri/src/commands/whisper.rs
@@ -45,8 +45,8 @@ impl WhisperServer {
.stdin(Stdio::piped())
.stdout(Stdio::piped())
.stderr(Stdio::piped());
- #[cfg(target_os = "windows")]
- cmd.creation_flags(CREATE_NO_WINDOW);
+ // Note: DO NOT use CREATE_NO_WINDOW for Python — libraries need valid stderr.
+ // Piped stderr already hides the console window.
let mut child = cmd.spawn()
.map_err(|e| format!("Failed to start whisper server: {}", e))?;
diff --git a/src/api/comfyui.ts b/src/api/comfyui.ts
index 00478d57..16a62599 100644
--- a/src/api/comfyui.ts
+++ b/src/api/comfyui.ts
@@ -291,9 +291,10 @@ export async function findMatchingVAE(modelType: ModelType): Promise<string> {
const lower = (s: string) => s.toLowerCase()
if (modelType === 'flux' || modelType === 'flux2') {
- const match = vaes.find(v => lower(v).includes('flux') || lower(v).includes('ae'))
+ const match = vaes.find(v => lower(v).includes('flux2') || lower(v).includes('flux'))
+ || vaes.find(v => lower(v).includes('ae'))
if (match) return match
- throw new Error(`No FLUX VAE found. Download "ae.safetensors" from the Model Manager (FLUX bundles include it).`)
+ throw new Error(`No FLUX VAE found. Download "flux2-vae.safetensors" from the Model Manager.`)
}
if (modelType === 'hunyuan') {
// HunyuanVideo has its own VAE — prefer it, fall back to Wan VAE
@@ -318,7 +319,14 @@ export async function findMatchingCLIP(modelType: ModelType): Promise<string> {
if (clips.length === 0) throw new Error('No text encoder models found. Download a CLIP/T5 model for your model type from the Model Manager.')
const lower = (s: string) => s.toLowerCase()
- if (modelType === 'flux' || modelType === 'flux2') {
+ if (modelType === 'flux2') {
+ // FLUX 2 uses Qwen or Mistral text encoders, NOT T5
+ const match = clips.find(c => lower(c).includes('qwen') && !lower(c).includes('qwen_2.5_vl'))
+ || clips.find(c => lower(c).includes('mistral'))
+ if (match) return match
+ throw new Error(`No FLUX 2 text encoder found. Download "qwen_3_4b_fp4_flux2.safetensors" from the Model Manager.`)
+ }
+ if (modelType === 'flux') {
const match = clips.find(c => lower(c).includes('t5') && !lower(c).includes('umt5'))
|| clips.find(c => lower(c).includes('clip_l'))
if (match) return match
diff --git a/src/hooks/useCreate.ts b/src/hooks/useCreate.ts
index 26d9ffde..18060590 100644
--- a/src/hooks/useCreate.ts
+++ b/src/hooks/useCreate.ts
@@ -303,8 +303,15 @@ export function useCreate() {
resolve()
} else if (history.status?.status_str === 'error') {
if (pollRef.current) clearInterval(pollRef.current)
- const errMsg = history.status?.messages?.[0]?.[1]?.message ?? 'Unknown ComfyUI error'
- reject(new Error(errMsg))
+ // Find the execution_error message which has the actual error details
+ const messages: [string, any][] = history.status?.messages ?? []
+ const errorEntry = messages.find(([t]) => t === 'execution_error')
+ const errMsg = errorEntry?.[1]?.exception_message
+ || errorEntry?.[1]?.message
+ || messages[messages.length - 1]?.[1]?.message
+ || 'Unknown ComfyUI error'
+ const nodeType = errorEntry?.[1]?.node_type ? ` (${errorEntry[1].node_type})` : ''
+ reject(new Error(errMsg.trim() + nodeType))
}
} catch (err) {
console.warn('[useCreate] Poll error:', err)