fix: can not find file when export - [INS-2030]#9636
Merged
CurryYangxx merged 2 commits intodevelopfrom Feb 5, 2026
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Fixes export failures by ensuring the destination folder exists before attempting to write the export file.
Changes:
- Create the parent directory for
options.pathwithfs.promises.mkdir(..., { recursive: true })before writing. - Keep the existing IPC
writeFilehandler behavior otherwise unchanged.
Comments suppressed due to low confidence (1)
packages/insomnia/src/main/ipc/main.ts:240
- The catch block wraps the original error with
new Error(err), which stringifies the caught value and discards the original stack trace (and can produce unhelpful messages whenerrisn’t a string). Sincemkdircan now fail for additional reasons, it’d be better to preserve the original error by rethrowing it when it’s already anError, and otherwise wrap withnew Error(String(err))(optionally including context like the target path).
await fs.promises.mkdir(dir, { recursive: true });
await fs.promises.writeFile(options.path, options.content);
return options.path;
} catch (err) {
throw new Error(err);
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
✅ Circular References ReportGenerated at: 2026-02-05T07:40:37.594Z Summary
Click to view all circular references in PR (85)Click to view all circular references in base branch (85)Analysis✅ No Change: This PR does not introduce or remove any circular references. This report was generated automatically by comparing against the |
ZxBing0066
approved these changes
Feb 4, 2026
ryan-willis
approved these changes
Feb 4, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
We need to make sure the folder exists before we write the file.