{"record":{"id":"f07ae903715d3b4a","repo":"tonhowtf/omniget","slug":"pick-thumbnail-error","errorCode":null,"errorMessage":"pick thumbnail error","messagePattern":"pick thumbnail error","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"src/components/dialog/TelegramUploadModal.svelte","lineNumber":112,"sourceCode":"    } finally {\n      loadingChats = false;\n    }\n  }\n\n  let chunkAnalysis = $derived(calculateTelegramChunks(fileSize, tier));\n\n  async function pickThumbnail() {\n    try {\n      const selected = await openFileDialog({\n        title: $t(\"telegram.pick_thumbnail\") as string,\n        filters: [{ name: \"Images\", extensions: [\"jpg\", \"jpeg\", \"png\", \"webp\"] }],\n        multiple: false,\n      });\n      if (selected && typeof selected === \"string\") {\n        customThumbPath = selected;\n      }\n    } catch (e) {\n      console.warn(\"pick thumbnail error\", e);\n    }\n  }\n\n  function clearThumbnail() {\n    customThumbPath = null;\n  }\n\n  function normalizeTargetChat(input: string): string {\n    let trimmed = input.trim();\n    if (trimmed.startsWith(\"https://t.me/\")) {\n      const parts = trimmed.replace(\"https://t.me/\", \"\").split(\"/\");\n      return \"@\" + parts[0];\n    }\n    if (trimmed.startsWith(\"t.me/\")) {\n      const parts = trimmed.replace(\"t.me/\", \"\").split(\"/\");\n      return \"@\" + parts[0];\n    }\n    return trimmed;","sourceCodeStart":94,"sourceCodeEnd":130,"githubUrl":"https://github.com/tonhowtf/omniget/blob/8600b91f4246848bac346874daa9e61c1fc5677a/src/components/dialog/TelegramUploadModal.svelte#L94-L130","documentation":"TelegramUploadModal's pickThumbnail opens a native file picker (dialog plugin) to select a custom thumbnail; if the picker call rejects, the warning is logged and customThumbPath simply stays null. No upload proceeds incorrectly — the feature is just unavailable for this attempt.","triggerScenarios":"The dialog/open invoke rejecting: no permission to show file dialogs, unsupported platform, dialog plugin not configured, or user-environment errors (e.g. dialog on unsupported webview).","commonSituations":"Running in a web build without the dialog plugin; missing Tauri dialog permissions in capabilities config; platform without a native file picker; plugin version mismatch after upgrade.","solutions":["Inspect the logged `e` to see if it's a permission vs unsupported-platform error.","Add the dialog plugin to the Tauri capability/allowlist if permission was denied.","Confirm the dialog plugin is installed and initialized for the current platform.","Optionally surface a user-visible toast that thumbnail picking is unavailable instead of silently swallowing."],"exampleFix":"// before\n} catch (e) { console.warn(\"pick thumbnail error\", e); }\n// after\n} catch (e) {\n  console.warn(\"pick thumbnail error\", e);\n  showToast(\"error\", $t(\"uploads.thumbnail_pick_failed\"));\n}","handlingStrategy":"type-guard","validationCode":"const hasDialog = typeof open === \"function\"; // dialog plugin imported/registered before showing picker","typeGuard":"function isPickedPath(v: unknown): v is string {\n  return typeof v === \"string\" && v.length > 0;\n}","tryCatchPattern":"try {\n  const selected = await open({ multiple: false });\n  if (isPickedPath(selected)) customThumbPath = selected;\n} catch (e) {\n  console.warn(\"pick thumbnail error\", e);\n  showToast(\"error\", \"Could not open file picker\");\n}","preventionTips":["Register and permission the dialog plugin in the Tauri config for every platform you ship.","Check plugin availability (feature detection) before offering the thumbnail button in the UI.","Give users visible feedback when picking fails instead of silently ignoring.","Test dialogs on all target platforms including web builds."],"tags":["file-dialog","tauri","permissions","ui"],"backgroundTag":"permission-denied","analyzedSha":"8600b91f4246848bac346874daa9e61c1fc5677a","analyzedAt":"2026-09-12T14:29:19.317Z","contentChangedAt":"2026-09-12T14:29:19.317Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}