tonhowtf/omniget · warning

pick thumbnail error

Error message

pick thumbnail error

What it means

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.

Solutions

  1. Inspect the logged `e` to see if it's a permission vs unsupported-platform error.
  2. Add the dialog plugin to the Tauri capability/allowlist if permission was denied.
  3. Confirm the dialog plugin is installed and initialized for the current platform.
  4. Optionally surface a user-visible toast that thumbnail picking is unavailable instead of silently swallowing.

Example fix

// before
} catch (e) { console.warn("pick thumbnail error", e); }
// after
} catch (e) {
  console.warn("pick thumbnail error", e);
  showToast("error", $t("uploads.thumbnail_pick_failed"));
}
Defensive patterns

Strategy: type-guard

Validate before calling

const hasDialog = typeof open === "function"; // dialog plugin imported/registered before showing picker

Type guard

function isPickedPath(v: unknown): v is string {
  return typeof v === "string" && v.length > 0;
}

Try / catch

try {
  const selected = await open({ multiple: false });
  if (isPickedPath(selected)) customThumbPath = selected;
} catch (e) {
  console.warn("pick thumbnail error", e);
  showToast("error", "Could not open file picker");
}

Prevention

When it happens

Trigger: 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).

Common situations: 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.

Understand the failure class

Background: Permission denied / not authorized / 403 Forbidden: access-control rejections when the caller lacks the required role, grant, or ownership — this error's family across 18 libraries.

Related errors


AI-assisted analysis of tonhowtf/omniget@8600b91f42 (2026-09-12). Data as JSON: /api/errors/f07ae903715d3b4a. Report an issue: GitHub.

Appendix: source

Thrown at src/components/dialog/TelegramUploadModal.svelte:112

    } finally {
      loadingChats = false;
    }
  }

  let chunkAnalysis = $derived(calculateTelegramChunks(fileSize, tier));

  async function pickThumbnail() {
    try {
      const selected = await openFileDialog({
        title: $t("telegram.pick_thumbnail") as string,
        filters: [{ name: "Images", extensions: ["jpg", "jpeg", "png", "webp"] }],
        multiple: false,
      });
      if (selected && typeof selected === "string") {
        customThumbPath = selected;
      }
    } catch (e) {
      console.warn("pick thumbnail error", e);
    }
  }

  function clearThumbnail() {
    customThumbPath = null;
  }

  function normalizeTargetChat(input: string): string {
    let trimmed = input.trim();
    if (trimmed.startsWith("https://t.me/")) {
      const parts = trimmed.replace("https://t.me/", "").split("/");
      return "@" + parts[0];
    }
    if (trimmed.startsWith("t.me/")) {
      const parts = trimmed.replace("t.me/", "").split("/");
      return "@" + parts[0];
    }
    return trimmed;

View on GitHub (pinned to 8600b91f42)