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
- 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.
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
- 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.
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
- [AntigravityRuntime] failed to resolve preferred target:
- [WorkbuddyAutoCheckin] 从 Rust 端获取配置失败,使用本地缓存或默认值:
- [WorkbuddyAutoCheckin] 保存配置到 Rust 后端失败:
- [AntigravityInstalledVersionBadge] failed to complete instal
- 加载诊断配置失败:
AI-assisted analysis of jlcodes99/cockpit-tools@1ed8b77992 (2026-09-05).
Data as JSON: /api/errors/aaa3406d35366b5f.
Report an issue: GitHub.