jlcodes99/cockpit-tools · info

[CodexExport] get downloads dir failed:

Error message

[CodexExport] get downloads dir failed:

What it means

A nested console.warn inside the Codex export flow: before opening a directory picker, the code tries invoke<string>("get_downloads_dir") to prefill defaultPath. If that Tauri command fails, the warning is logged and the flow continues with defaultPath undefined — the user just gets no preselected folder.

Source

Thrown at src/pages/useCodexAccountsBaseController.tsx:1620

        clearExportModalError,
        formattedSavingExportDocumentId,
        reportExportModalError,
        saveJsonFile,
        t,
      ],
    );
  
    const saveAllFormattedExportDocuments = useCallback(async () => {
      if (!formattedExportDocuments.length || formattedBatchSavingExportJson)
        return;
      setFormattedBatchSavingExportJson(true);
      try {
        clearExportModalError();
        let defaultPath: string | undefined;
        try {
          defaultPath = await invoke<string>("get_downloads_dir");
        } catch (error) {
          console.warn("[CodexExport] get downloads dir failed:", error);
        }
  
        const selected = await openFileDialog({
          directory: true,
          multiple: false,
          defaultPath,
        });
        if (!selected || Array.isArray(selected)) {
          return;
        }
  
        for (const document of formattedExportDocuments) {
          const targetPath = joinFilePath(
            selected,
            buildExportFileName(document.fileNameBase),
          );
          await invoke("save_text_file", {
            path: targetPath,

View on GitHub (pinned to 1ed8b77992)

Solutions

  1. Ignore — export still works via the manual folder picker.
  2. Confirm the app build includes the get_downloads_dir Tauri command and its permission allowlist entry.
  3. Check the OS user profile has a valid Downloads directory (XDG config on Linux, shell folders on Windows).
  4. If in a browser/dev build, expect this command to be unavailable; test in the packaged desktop app.
  5. Update the app if the command was recently renamed or added to the allowlist.
Defensive patterns

Strategy: fallback

Try / catch

let defaultPath: string | undefined;
try {
  defaultPath = await invoke<string>('get_downloads_dir');
} catch (e) {
  console.warn('[CodexExport] get downloads dir failed:', e);
  defaultPath = undefined; // picker opens without preset
}

Prevention

When it happens

Trigger: invoke("get_downloads_dir") rejects: the Tauri command is not registered/allowed in the current build, the OS has no resolvable Downloads directory (non-standard user profile), or the backend call errors.

Common situations: Running in a dev/web build without the Tauri command wired; Linux/Windows profiles with redirected or missing Downloads folder; permission-restricted environments.

Related errors


AI-assisted analysis of jlcodes99/cockpit-tools@1ed8b77992 (2026-09-05). Data as JSON: /api/errors/aaa3406d35366b5f. Report an issue: GitHub.