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(errors): another program's output stops pretending to be our error message

David80ab527db288
diff --git a/src-tauri/src/commands/process.rs b/src-tauri/src/commands/process.rs
index ffb69d09..f623e1a2 100644
--- a/src-tauri/src/commands/process.rs
+++ b/src-tauri/src/commands/process.rs
@@ -1038,7 +1038,7 @@ fn start_ollama_blocking(state: &AppState) -> Result<serde_json::Value, String>
Err(e) => {
println!("[Ollama] Failed to start: {}", e);
error!(error = %e, "ollama spawn failed");
- Ok(serde_json::json!({"status": "error", "error": e.to_string()}))
+ Ok(serde_json::json!({"status": "error", "error": os_error::english(&e)}))
}
}
}
diff --git a/src-tauri/src/os_error.rs b/src-tauri/src/os_error.rs
index 7cacf6f9..a0c09453 100644
--- a/src-tauri/src/os_error.rs
+++ b/src-tauri/src/os_error.rs
@@ -307,6 +307,19 @@ mod drift_guard {
OS_CALLS.iter().any(|c| code.contains(c)) && renders_the_error(code)
}
+ /// The other shape: not a map_err at all, but an error FIELD in a payload
+ /// built straight from the value. `start_ollama` answered a failed spawn
+ /// with `json!({"status": "error", "error": e.to_string()})`, which the
+ /// window scan above cannot see, because the spawn is in a match arm
+ /// several lines up.
+ fn is_suspect_field(line: &str) -> bool {
+ let code = strip_comment(line);
+ if code.contains("os_error::") {
+ return false;
+ }
+ code.contains("\"error\"") && code.contains("e.to_string()")
+ }
+
fn rust_files(dir: &Path, out: &mut Vec<PathBuf>) {
for entry in std::fs::read_dir(dir).expect("src is readable").flatten() {
let path = entry.path();
@@ -347,6 +360,11 @@ mod drift_guard {
found.push(format!("{}:{}: {}", file.display(), i + 1, lines[i].trim()));
}
}
+ for (i, line) in lines.iter().enumerate() {
+ if is_suspect_field(line) {
+ found.push(format!("{}:{}: {}", file.display(), i + 1, line.trim()));
+ }
+ }
}
assert!(
found.is_empty(),
@@ -375,5 +393,11 @@ mod drift_guard {
r#".send() .await .map_err(|e| format!("proxy: {}", os_error::english(&e)))?"#
));
assert!(!is_suspect(r#"let n = parse(s).map_err(|e| format!("bad number: {e}"))?;"#));
+ // The payload shape, which no window around the failing call can reach.
+ assert!(is_suspect_field(r#"json!({"status": "error", "error": e.to_string()})"#));
+ assert!(!is_suspect_field(
+ r#"json!({"status": "error", "error": os_error::english(&e)})"#
+ ));
+ assert!(!is_suspect_field(r#"json!({"error": "All search tiers failed"})"#));
}
}
diff --git a/src/components/layout/DownloadBadge.tsx b/src/components/layout/DownloadBadge.tsx
index e272d86a..796c5bef 100644
--- a/src/components/layout/DownloadBadge.tsx
+++ b/src/components/layout/DownloadBadge.tsx
@@ -1,4 +1,5 @@
import { useState, useRef, useEffect } from 'react'
+import { withInstallerOutput } from '../../lib/error-text'
import { motion, AnimatePresence } from 'framer-motion'
import { ArrowDownToLine, Pause, Play, X, CheckCircle, RotateCcw } from 'lucide-react'
import { useModels } from '../../hooks/useModels'
@@ -286,7 +287,7 @@ export function DownloadBadge() {
{e.status === 'complete' ? (
<div className="flex items-center gap-1.5 text-green-400"><CheckCircle size={11} /><span className="text-[0.65rem]">Complete</span></div>
) : e.status === 'error' ? (
- <p className="text-[0.6rem] text-red-400 break-words">{e.error || 'Install failed.'}</p>
+ <p className="text-[0.6rem] text-red-400 break-words whitespace-pre-line">{withInstallerOutput('The install did not finish.', e.error)}</p>
) : e.total > 0 ? (
<>
<ProgressBar progress={prog} />
diff --git a/src/components/onboarding/Onboarding.tsx b/src/components/onboarding/Onboarding.tsx
index ac0594c5..5ee5b0e7 100644
--- a/src/components/onboarding/Onboarding.tsx
+++ b/src/components/onboarding/Onboarding.tsx
@@ -1,4 +1,5 @@
import { useState, useEffect } from 'react'
+import { withInstallerOutput } from '../../lib/error-text'
import { motion, AnimatePresence } from 'framer-motion'
import { Minus, Square, X as XIcon, ArrowRight, Download, Check, ChevronRight, Loader2, RefreshCw, ExternalLink, FolderOpen, Cpu } from 'lucide-react'
import { useSettingsStore } from '../../stores/settingsStore'
@@ -718,8 +719,8 @@ export function Onboarding() {
clearInterval(poll)
setPythonInstalling(false)
setPythonStartTime(null)
- const lastLog = status.logs?.[status.logs.length - 1] || 'Python install failed'
- setPythonInstallError(lastLog)
+ const lastLog = status.logs?.[status.logs.length - 1] || ''
+ setPythonInstallError(withInstallerOutput('Installing Python did not finish.', lastLog))
resolve(false)
}
} catch { /* keep polling */ }
@@ -964,8 +965,8 @@ export function Onboarding() {
clearInterval(poll)
setOllamaInstalling(false)
setOllamaStartTime(null)
- const lastLog = s.logs?.[s.logs.length - 1] || 'Installation failed'
- setOllamaError(lastLog)
+ const lastLog = s.logs?.[s.logs.length - 1] || ''
+ setOllamaError(withInstallerOutput('Installing Ollama did not finish.', lastLog))
}
} catch { /* keep polling */ }
}, 1000)
@@ -1025,7 +1026,7 @@ export function Onboarding() {
{/* Error */}
{ollamaError && (
- <p className="text-[0.65rem] text-red-400">{ollamaError}</p>
+ <p className="text-[0.65rem] text-red-400 whitespace-pre-line">{ollamaError}</p>
)}
{/* LM Studio ready */}
@@ -1083,8 +1084,8 @@ export function Onboarding() {
clearInterval(poll)
setLmstudioInstalling(false)
setLmstudioStartTime(null)
- const lastLog = s.logs?.[s.logs.length - 1] || 'Installation failed'
- setLmstudioError(lastLog)
+ const lastLog = s.logs?.[s.logs.length - 1] || ''
+ setLmstudioError(withInstallerOutput('Installing LM Studio did not finish.', lastLog))
}
} catch { /* keep polling */ }
}, 1000)
@@ -1146,7 +1147,7 @@ export function Onboarding() {
)}
{lmstudioError && (
- <p className="text-[0.65rem] text-red-400">
+ <p className="text-[0.65rem] text-red-400 whitespace-pre-line">
{lmstudioError}
{lmstudioError.toLowerCase().includes('didn\'t come up') && (
<button
@@ -1357,8 +1358,8 @@ export function Onboarding() {
clearInterval(poll)
setComfyInstalling(false)
setInstallStartTime(null)
- const lastLog = status.logs?.[status.logs.length - 1] || 'Installation failed'
- setComfyInstallError(lastLog)
+ const lastLog = status.logs?.[status.logs.length - 1] || ''
+ setComfyInstallError(withInstallerOutput('Installing ComfyUI did not finish.', lastLog))
}
} catch { /* keep polling */ }
}, 2000)
@@ -1517,7 +1518,7 @@ export function Onboarding() {
{/* Error */}
{comfyInstallError && (
- <p className="text-[0.65rem] text-red-400">{comfyInstallError}</p>
+ <p className="text-[0.65rem] text-red-400 whitespace-pre-line">{comfyInstallError}</p>
)}
{/* Ready state */}
diff --git a/src/components/settings/SettingsPage.tsx b/src/components/settings/SettingsPage.tsx
index c5df7b0b..2ef992de 100644
--- a/src/components/settings/SettingsPage.tsx
+++ b/src/components/settings/SettingsPage.tsx
@@ -1,4 +1,5 @@
import { useState, useEffect, useRef, type ReactNode, type ChangeEvent } from 'react'
+import { withInstallerOutput } from '../../lib/error-text'
import { ArrowLeft, RotateCcw, Sun, Moon, Volume2, Check, X, Loader2, Shield, ChevronRight, GraduationCap, Lock, Sliders, Plug, Bot, Phone, User, Download, Mic } from 'lucide-react'
import { motion, AnimatePresence } from 'framer-motion'
import { SETTINGS_TAB_RESET_KEYS, type SettingsTab } from '../../lib/settings-reset'
@@ -479,7 +480,7 @@ function ComfyUISettings() {
} else if (data.status === 'error' || data.status === 'cancelled') {
clearInterval(poll)
const lastLog = (data.logs?.length ? data.logs[data.logs.length - 1] : '') as string
- setInstallErr(lastLog || 'Environment repair failed')
+ setInstallErr(withInstallerOutput('Repairing the environment did not finish.', lastLog))
setInstallPhase('error')
}
} catch { /* keep polling */ }
@@ -708,7 +709,7 @@ function ComfyUISettings() {
} else if (data.status === 'error') {
clearInterval(poll)
const lastLog = (data.logs?.length ? data.logs[data.logs.length - 1] : '') as string
- setInstallErr(lastLog || 'Python install failed')
+ setInstallErr(withInstallerOutput('Installing Python did not finish.', lastLog))
resolve(false)
}
} catch { /* keep polling */ }
@@ -738,7 +739,7 @@ function ComfyUISettings() {
} else if (data.status === 'error') {
clearInterval(poll)
const lastLog = (data.logs?.length ? data.logs[data.logs.length - 1] : '') as string
- setInstallErr(lastLog || 'ComfyUI install failed')
+ setInstallErr(withInstallerOutput('Installing ComfyUI did not finish.', lastLog))
setInstallPhase('error')
}
} catch { /* keep polling */ }
@@ -776,7 +777,7 @@ function ComfyUISettings() {
} else if (data.status === 'error') {
clearInterval(poll)
const lastLog = (data.logs?.length ? data.logs[data.logs.length - 1] : '') as string
- setInstallErr(lastLog || 'ComfyUI update failed')
+ setInstallErr(withInstallerOutput('Updating ComfyUI did not finish.', lastLog))
setInstallPhase('error')
}
} catch { /* keep polling */ }
@@ -1133,7 +1134,7 @@ export function SettingsPage() {
} catch { /* transient — keep polling */ }
if (s.status === 'complete') break
if (s.status === 'error') {
- setWhisperInstallError(s.error || 'Install failed.')
+ setWhisperInstallError(withInstallerOutput('Installing speech to text did not finish.', s.error))
break
}
if (Date.now() - start > 600_000) {
@@ -1167,7 +1168,7 @@ export function SettingsPage() {
} catch { /* transient — keep polling */ }
if (s.status === 'complete') break
if (s.status === 'error') {
- setTtsInstallError(s.error || 'Install failed.')
+ setTtsInstallError(withInstallerOutput('Installing read aloud did not finish.', s.error))
break
}
if (Date.now() - start > 600_000) {
diff --git a/src/lib/__tests__/error-text.test.ts b/src/lib/__tests__/error-text.test.ts
new file mode 100644
index 00000000..8ba010b5
--- /dev/null
+++ b/src/lib/__tests__/error-text.test.ts
@@ -0,0 +1,84 @@
+/**
+ * The new rule, 2026-08-22: an error a user reads is English, always.
+ *
+ * Two halves. The Rust half is fixed at the source, where the operating
+ * system's own wording is replaced before it ever leaves the backend. This is
+ * the other half: text written by a program that is not ours. A German Windows
+ * runs a German winget, and the last line of its log used to BE our error
+ * message, with no subject and no hint of who said it.
+ */
+import { describe, it, expect } from 'vitest'
+import { detailOf, withDetail, withInstallerOutput } from '../error-text'
+
+describe('detailOf', () => {
+ it('reads a string, an Error and anything else', () => {
+ expect(detailOf('boom')).toBe('boom')
+ expect(detailOf(new Error('boom'))).toBe('boom')
+ expect(detailOf(404)).toBe('404')
+ })
+
+ it('is empty for nothing at all, so a frame stays a clean sentence', () => {
+ expect(detailOf(null)).toBe('')
+ expect(detailOf(undefined)).toBe('')
+ expect(detailOf(new Error(''))).toBe('')
+ })
+})
+
+describe('withDetail', () => {
+ it('our sentence comes first and the foreign text is labelled', () => {
+ const out = withDetail('The update could not be installed.', 'Zugriff verweigert')
+ expect(out.startsWith('The update could not be installed.')).toBe(true)
+ expect(out).toContain('Details:')
+ // The detail is kept. It is the only thing that says what actually failed.
+ expect(out).toContain('Zugriff verweigert')
+ })
+
+ it('with nothing to add it is just the sentence', () => {
+ expect(withDetail('Install failed.', '')).toBe('Install failed.')
+ expect(withDetail('Install failed.', null)).toBe('Install failed.')
+ })
+
+ it('does not frame our own sentence twice on the way up', () => {
+ const once = withDetail('Install failed.', 'pip exploded')
+ expect(withDetail('Install failed.', once)).toBe(once)
+ })
+
+ it('the installer frame names who is talking', () => {
+ const out = withInstallerOutput('Installing Python failed.', 'Fehler beim Installieren')
+ expect(out).toContain('Last output from the installer')
+ expect(out.startsWith('Installing Python failed.')).toBe(true)
+ })
+})
+
+describe('the surfaces that used to set foreign text as the whole message', () => {
+ const read = (p: string) =>
+ // eslint-disable-next-line @typescript-eslint/no-var-requires
+ require('node:fs').readFileSync(
+ require('node:path').resolve(__dirname, '..', '..', p),
+ 'utf8',
+ ) as string
+
+ it('first run frames every installer log tail', () => {
+ // Onboarding is the highest visibility surface in the app and it had four
+ // of these, one per installer. A bare log tail there is the first thing a
+ // new user ever reads from us.
+ const src = read('components/onboarding/Onboarding.tsx')
+ expect(src).toContain('withInstallerOutput')
+ expect(src).not.toMatch(/set\w*Error\(lastLog\)/)
+ expect(src).not.toMatch(/setPythonInstallError\(lastLog\)/)
+ })
+
+ it('Settings frames its installer log tails too', () => {
+ const src = read('components/settings/SettingsPage.tsx')
+ expect(src).toContain('withInstallerOutput')
+ expect(src).not.toMatch(/setInstallErr\(lastLog \|\|/)
+ })
+
+ it('the updater frames what the update plugin reports', () => {
+ // This one is third party Rust we do not own, so it cannot be fixed at the
+ // source the way our own commands were.
+ const src = read('stores/updateStore.ts')
+ expect(src).toContain('withDetail')
+ expect(src).not.toMatch(/errorMessage: e instanceof Error \? e\.message :/)
+ })
+})
diff --git a/src/lib/error-text.ts b/src/lib/error-text.ts
new file mode 100644
index 00000000..90572e1c
--- /dev/null
+++ b/src/lib/error-text.ts
@@ -0,0 +1,47 @@
+/**
+ * English frames for text we did not write.
+ *
+ * David, 2026-08-22, from the box: the app showed a failure that was half
+ * German. The Rust side is fixed at the source now (src-tauri/src/os_error.rs),
+ * so what the backend hands us is English again. This file is about the other
+ * half, the text that is not ours to fix.
+ *
+ * An installer we shell out to answers in the system language. winget on a
+ * German Windows prints German, and no amount of care on our side changes
+ * that. What we can promise is that the SENTENCE is ours and English, and that
+ * the foreign text is labelled as what it is: output from another program,
+ * quoted, not spoken by us.
+ *
+ * The rule this replaces is the one that reads worst in practice: taking the
+ * last line of somebody else's log and setting it as the whole error. The user
+ * then gets a German fragment with no subject, no context and no clue which
+ * program said it.
+ */
+
+/** The readable text of anything that was thrown, caught or returned. */
+export function detailOf(e: unknown): string {
+ if (e == null) return ''
+ if (typeof e === 'string') return e.trim()
+ if (e instanceof Error) return (e.message || '').trim()
+ return String(e).trim()
+}
+
+/**
+ * Our English sentence, with the foreign text kept underneath it.
+ *
+ * The detail is never dropped: it is usually the only thing that says which
+ * package failed or which port was taken, and support reads it. It is only
+ * moved out of the position where it pretended to be our message.
+ */
+export function withDetail(sentence: string, detail: unknown, label = 'Details'): string {
+ const raw = detailOf(detail)
+ if (!raw) return sentence
+ // Already our own sentence coming back up a call chain: do not frame twice.
+ if (raw.startsWith(sentence)) return raw
+ return `${sentence}\n\n${label}:\n${raw}`
+}
+
+/** The frame for the tail of another program's log. */
+export function withInstallerOutput(sentence: string, detail: unknown): string {
+ return withDetail(sentence, detail, 'Last output from the installer')
+}
diff --git a/src/stores/updateStore.ts b/src/stores/updateStore.ts
index 685b6719..411da312 100644
--- a/src/stores/updateStore.ts
+++ b/src/stores/updateStore.ts
@@ -1,4 +1,5 @@
import { create } from 'zustand'
+import { withDetail } from '../lib/error-text'
import { persist } from 'zustand/middleware'
import { version as currentVersion } from '../../package.json'
import { isTauri, backendCall, openExternal } from '../api/backend'
@@ -221,7 +222,7 @@ export const useUpdateStore = create<UpdateState>()(
} catch (e) {
set({
downloadStatus: 'error',
- errorMessage: e instanceof Error ? e.message : 'Download failed',
+ errorMessage: withDetail('The update could not be downloaded.', e),
})
}
},
@@ -277,7 +278,7 @@ export const useUpdateStore = create<UpdateState>()(
} catch (e) {
set({
downloadStatus: 'error',
- errorMessage: e instanceof Error ? e.message : 'Install failed',
+ errorMessage: withDetail('The update could not be installed.', e),
})
}
},