block/buzz · error · Error
${error}
Error message
${error} What it means
Tauri IPC rejections are not always Error instances; uploadMediaFile normalizes them. This throw re-raises a non-empty string rejection as a real Error with the backend's message as text. The literal message equals whatever string the Tauri command returned.
Source
Thrown at desktop/src/shared/api/tauriMedia.ts:43
if (progressId) {
headers["x-buzz-progress-id"] = encodeRawIpcHeader(progressId);
}
if (signal?.aborted) throw new Error("upload cancelled");
const bytes = new Uint8Array(await file.arrayBuffer());
if (signal?.aborted) throw new Error("upload cancelled");
onDispatch?.();
try {
return await invokeTauriRaw<BlobDescriptor>(
"upload_media_bytes_raw",
bytes,
{
headers,
},
);
} catch (error) {
if (error instanceof Error) throw error;
if (typeof error === "string" && error.trim()) throw new Error(error);
if (
typeof error === "object" &&
error !== null &&
"message" in error &&
typeof error.message === "string" &&
error.message.trim()
) {
throw new Error(error.message);
}
throw new Error("Media upload failed.");
}
}
/** Stop the native HTTP request associated with a background media upload. */
export async function cancelMediaUpload(progressId: string): Promise<void> {
await invokeTauri("cancel_media_upload", { progressId });
}
View on GitHub (pinned to dad5a33865)
Solutions
- Read error.message — it contains the native/backend error text and diagnose from there.
- Check relay/media server logs for the matching failure (auth, quota, size).
- Validate file size/type limits client-side before uploading.
- Upgrade error handling to attach context (filename, progressId) when rethrowing.
Example fix
// before
catch (e) { console.log(e); }
// after
catch (e) {
const msg = e instanceof Error ? e.message : String(e);
throw new Error(`Media upload of ${file.name} failed: ${msg}`);
} Defensive patterns
Strategy: try-catch
Validate before calling
if (file.size > MAX_UPLOAD_BYTES) throw new Error('File too large before upload');
Type guard
function isStringRejection(e: unknown): e is Error { return typeof e === 'string' && e.trim().length > 0; }
Try / catch
try { await uploadMediaFile(file); } catch (e) { const msg = e instanceof Error ? e.message : String(e); handleError(msg); }
Prevention
- Validate size/type client-side before upload
- Keep media server auth tokens fresh
- Log error.message — it carries the backend text
When it happens
Trigger: upload_media_bytes_raw rejects with a bare string (Rust error serialized as a string) — e.g. native HTTP failure, server 4xx/5xx body, or IPC layer error text.
Common situations: Media server rejecting the upload (auth, size limit); Rust command returning Err(String); proxy/timeouts surfaced as raw strings by the Tauri plugin.
Related errors
- ${error.message}
- Media upload failed.
- {error} (and the local stores could not be restored: {restor
- upload cancelled
- Media fetch cancelled
AI-assisted analysis of block/buzz@dad5a33865 (2026-09-05).
Data as JSON: /api/errors/ae5d7d34a51d79ea.
Report an issue: GitHub.