{"record":{"id":"aaa3406d35366b5f","repo":"jlcodes99/cockpit-tools","slug":"codexexport-get-downloads-dir-failed","errorCode":null,"errorMessage":"[CodexExport] get downloads dir failed:","messagePattern":"\\[CodexExport\\] get downloads dir failed:","errorType":"console","errorClass":null,"httpStatus":null,"severity":"info","filePath":"src/pages/useCodexAccountsBaseController.tsx","lineNumber":1620,"sourceCode":"        clearExportModalError,\n        formattedSavingExportDocumentId,\n        reportExportModalError,\n        saveJsonFile,\n        t,\n      ],\n    );\n  \n    const saveAllFormattedExportDocuments = useCallback(async () => {\n      if (!formattedExportDocuments.length || formattedBatchSavingExportJson)\n        return;\n      setFormattedBatchSavingExportJson(true);\n      try {\n        clearExportModalError();\n        let defaultPath: string | undefined;\n        try {\n          defaultPath = await invoke<string>(\"get_downloads_dir\");\n        } catch (error) {\n          console.warn(\"[CodexExport] get downloads dir failed:\", error);\n        }\n  \n        const selected = await openFileDialog({\n          directory: true,\n          multiple: false,\n          defaultPath,\n        });\n        if (!selected || Array.isArray(selected)) {\n          return;\n        }\n  \n        for (const document of formattedExportDocuments) {\n          const targetPath = joinFilePath(\n            selected,\n            buildExportFileName(document.fileNameBase),\n          );\n          await invoke(\"save_text_file\", {\n            path: targetPath,","sourceCodeStart":1602,"sourceCodeEnd":1638,"githubUrl":"https://github.com/jlcodes99/cockpit-tools/blob/1ed8b77992d62ca81fabf744deb0839ad361d5bf/src/pages/useCodexAccountsBaseController.tsx#L1602-L1638","documentation":"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.","triggerScenarios":"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.","commonSituations":"Running in a dev/web build without the Tauri command wired; Linux/Windows profiles with redirected or missing Downloads folder; permission-restricted environments.","solutions":["Ignore — export still works via the manual folder picker.","Confirm the app build includes the get_downloads_dir Tauri command and its permission allowlist entry.","Check the OS user profile has a valid Downloads directory (XDG config on Linux, shell folders on Windows).","If in a browser/dev build, expect this command to be unavailable; test in the packaged desktop app.","Update the app if the command was recently renamed or added to the allowlist."],"exampleFix":null,"handlingStrategy":"fallback","validationCode":null,"typeGuard":null,"tryCatchPattern":"let defaultPath: string | undefined;\ntry {\n  defaultPath = await invoke<string>('get_downloads_dir');\n} catch (e) {\n  console.warn('[CodexExport] get downloads dir failed:', e);\n  defaultPath = undefined; // picker opens without preset\n}","preventionTips":["Treat get_downloads_dir as best-effort; never block the export flow on it.","Register the command in the Tauri allowlist for every build target you ship.","Test in packaged desktop builds, not just browser/dev mode, where invoke is unavailable."],"tags":["tauri","invoke","filesystem","graceful-degradation"],"backgroundTag":"tauri-command-invoke-failed","analyzedSha":"1ed8b77992d62ca81fabf744deb0839ad361d5bf","analyzedAt":"2026-09-05T09:51:41.178Z","contentChangedAt":"2026-09-05T09:51:41.178Z","schemaVersion":2},"datasetVersion":"2026-09-12T12:17:11.808Z"}