{"record":{"id":"b738c7a37e4bafb0","repo":"tonhowtf/omniget","slug":"omnidisc-media-capabilities-unavailable","errorCode":null,"errorMessage":"[omnidisc] media capabilities unavailable","messagePattern":"\\[omnidisc\\] media capabilities unavailable","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"src/lib/stores/omnidisc-stream-store.svelte.ts","lineNumber":166,"sourceCode":"}\n\nexport function getStreamError(): string | null {\n  return lastError;\n}\n\nexport function clearStreamError() {\n  lastError = null;\n}\n\nexport function getMediaCapabilities(): MediaCapabilities {\n  return capabilities;\n}\n\nexport async function refreshMediaCapabilities(): Promise<void> {\n  try {\n    capabilities = await invoke<MediaCapabilities>(\"omnidisc_media_capabilities\");\n  } catch (e) {\n    console.warn(\"[omnidisc] media capabilities unavailable\", errorText(e));\n  }\n}\n\nexport function isStreamer(userId: string): boolean {\n  return streamers[userId] === true;\n}\n\nexport function getStreamerIds(): string[] {\n  return Object.keys(streamers).filter((id) => streamers[id]);\n}\n\nexport function getStreamPreview(): string | null {\n  return previewImage;\n}\n\nexport function markStreamer(userId: string, on: boolean) {\n  if (streamers[userId] === on) return;\n  streamers = { ...streamers, [userId]: on };","sourceCodeStart":148,"sourceCodeEnd":184,"githubUrl":"https://github.com/tonhowtf/omniget/blob/8600b91f4246848bac346874daa9e61c1fc5677a/src/lib/stores/omnidisc-stream-store.svelte.ts#L148-L184","documentation":"refreshMediaCapabilities calls the Tauri backend command `omnidisc_media_capabilities` via invoke(). When the backend command rejects or is missing, the promise rejects and the store logs this warning, leaving `capabilities` unset (null/stale). It is deliberately non-fatal: the app keeps running with degraded media-capability knowledge.","triggerScenarios":"Calling initStream()/refreshMediaCapabilities() when the Rust command `omnidisc_media_capabilities` is not registered, panics, or returns a serialization-incompatible value (e.g. the webview runs against an older backend build without the command).","commonSituations":"Running a frontend dev build against a stale Rust binary that lacks the omnidisc media command; backend panic while probing hardware codecs; MediaCapabilities struct fields renamed on the Rust side so serde deserialization fails.","solutions":["Rebuild/restart the Rust backend so the `omnidisc_media_capabilities` command is registered and matches the frontend's expected MediaCapabilities shape.","Check the Rust command name and#[tauri::command] registration in the invoke_handler list for typos.","Verify serde field names on the Rust MediaCapabilities struct match the TypeScript type exactly (camelCase vs snake_case).","Handle the null/stale capabilities downstream (check isStreamer/capabilities before assuming codec support)."],"exampleFix":"// before\ncapabilities = await invoke<MediaCapabilities>(\"omnidisc_media_capabilities\");\n// after\ncapabilities = await invoke<MediaCapabilities>(\"omnidisc_media_capabilities\") ?? DEFAULT_CAPABILITIES;","handlingStrategy":"fallback","validationCode":"if (!('__TAURI_INTERNALS__' in window)) { console.warn('not in Tauri runtime; skipping media capabilities'); }","typeGuard":"function hasCapabilities(c: unknown): c is MediaCapabilities {\n  return typeof c === 'object' && c !== null;\n}","tryCatchPattern":"let capabilities: MediaCapabilities | null = null;\ntry {\n  capabilities = await invoke<MediaCapabilities>(\"omnidisc_media_capabilities\");\n} catch (e) {\n  capabilities = DEFAULT_CAPABILITIES; // safe fallback\n}","preventionTips":["Keep frontend TypeScript types and Rust serde structs generated from one source of truth.","Always rebuild the backend together with the frontend during development.","Treat capability probes as optional: code against a default capabilities object.","Verify command registration in tauri::invoke_handler after adding new commands."],"tags":["tauri","ipc","media","capabilities"],"backgroundTag":"api-request-failed","analyzedSha":"8600b91f4246848bac346874daa9e61c1fc5677a","analyzedAt":"2026-09-12T14:29:19.317Z","contentChangedAt":"2026-09-12T14:29:19.317Z","schemaVersion":2},"datasetVersion":"2026-09-15T23:17:13.987Z"}