iOfficeAI/AionUi · error
result?.msg || fallbackMessage
Error message
result?.msg || fallbackMessage
What it means
`assertBridgeSuccess` narrows IPC bridge responses: when `result.success` is falsy (or result is undefined), it throws with the bridge-supplied `msg` or a caller-provided `fallbackMessage`. It converts silent backend failures into renderer-side exceptions.
Source
Thrown at packages/desktop/src/renderer/pages/conversation/platforms/assertBridgeSuccess.ts:24
}
| null
| undefined;
export const assertBridgeSuccess = <T>(
result: BridgeResult<T>,
fallbackMessage: string
): {
success: true;
data?: T;
} => {
if (result?.success === true) {
return result as {
success: true;
data?: T;
};
}
throw new Error(result?.msg || fallbackMessage);
};
View on GitHub (pinned to 711aa0550e)
Solutions
- Inspect `result.msg` in the caught error — it usually carries the backend's rejection reason
- Fix the underlying condition the backend reports (missing config, invalid input)
- Confirm renderer and main-process versions match so the bridge envelope shape is consistent
- If the handler can legitimately return undefined, guard upstream instead of relying on the fallback message
Example fix
// before
const result = await ipcBridge.someOp.invoke(payload);
const data = assertBridgeSuccess(result, 'op failed');
// after (surface backend reason)
const result = await ipcBridge.someOp.invoke(payload);
if (!result?.success) {
console.warn('op rejected:', result?.msg);
}
const data = assertBridgeSuccess(result, 'op failed'); Defensive patterns
Strategy: try-catch
Validate before calling
const result = await ipcBridge.op.invoke(payload);
if (!result?.success) { /* read result.msg, fix precondition */ } Type guard
type BridgeResult<T> = { success: true; data?: T } | { success: false; msg?: string };
const isBridgeOk = <T>(r: BridgeResult<T> | undefined): r is { success: true; data?: T } => !!r?.success; Try / catch
try { const d = assertBridgeSuccess(await op()); } catch (e) { showError(e instanceof Error ? e.message : 'unknown'); } Prevention
- Always log result.msg when success is false
- Version-lock renderer and main bridge envelope shapes
When it happens
Trigger: Any bridge call whose response has `success: false` — the backend rejected the operation (validation failure, missing config, permission denied) — or an undefined result because the handler crashed or returned nothing.
Common situations: Backend rejects a platform operation (e.g. missing credentials, invalid params); IPC handler threw and the wrapper swallowed it into a `{success:false, msg}` envelope; version skew where a newer renderer calls an older main-process handler that returns undefined.
Related errors
- fork returned no conversation
- scm port not configured
- File data not found
- Image file not found
- t(keys.startFailed)
AI-assisted analysis of iOfficeAI/AionUi@711aa0550e (2026-08-28).
Data as JSON: /api/errors/69bea7d6df8ca160.
Report an issue: GitHub.