fix(import): resolve EEXIST error when importing OpenAPI collections with paths folder arrangement#7499
Conversation
…ths grouping
Use { recursive: true } in mkdirSync during collection import so that
directories which already exist (e.g. due to duplicate or case-colliding
path params like {customerID} vs {customerId}) do not throw EEXIST and
abort the import.
WalkthroughModified folder creation logic in the collection parser to use Changes
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~2 minutes Suggested labels
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
📝 Coding Plan
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment Tip CodeRabbit can generate a title for your PR based on the changes.Add |
|
@abhishek-bruno Please update playwright tests to cover this scenario |
Description
JIRA
Problem
Importing an OpenAPI spec using the Paths folder arrangement fails with:
Error EEXIST: file already exists, mkdir '.../{customerID}'
The collection directory is partially created on disk but never opens in Bruno. This affects both macOS and Windows.
Root cause
The import handler calls fs.mkdirSync(folderPath) without { recursive: true }. When a spec contains paths with the same path parameter name in different casing (e.g. {customerId} and {customerID}), the path-based grouper creates two distinct folder items for them. On case-insensitive filesystems, both map to the same directory — the second mkdirSync call throws EEXIST, aborting the import and preventing main:collection-opened from firing.
Fix
Pass { recursive: true } to mkdirSync in parseCollectionItems inside the renderer:import-collection handler. This silently succeeds if the directory already exists instead of throwing, allowing the import to complete. Both sets of requests are written into the same folder, which is the correct behavior since they represent the same URL pattern.
Contribution Checklist:
Note: Keeping the PR small and focused helps make it easier to review and merge. If you have multiple changes you want to make, please consider submitting them as separate pull requests.
Publishing to New Package Managers
Please see here for more information.
Summary by CodeRabbit
Release Notes