Skip to content

fix(import): resolve EEXIST error when importing OpenAPI collections with paths folder arrangement#7499

Merged
bijin-bruno merged 1 commit intousebruno:mainfrom
abhishek-bruno:fix/openapi-paths-import-eexist
Mar 24, 2026
Merged

fix(import): resolve EEXIST error when importing OpenAPI collections with paths folder arrangement#7499
bijin-bruno merged 1 commit intousebruno:mainfrom
abhishek-bruno:fix/openapi-paths-import-eexist

Conversation

@abhishek-bruno
Copy link
Copy Markdown
Member

@abhishek-bruno abhishek-bruno commented Mar 16, 2026

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:

  • I've used AI significantly to create this pull request
  • The pull request only addresses one issue or adds one feature.
  • The pull request does not introduce any breaking changes
  • I have added screenshots or gifs to help explain the change if applicable.
  • I have read the contribution guidelines.
  • Create an issue and link to the pull request.

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

  • Bug Fixes
    • Fixed an issue where creating nested folder structures would fail if parent directories didn't exist. The system now automatically creates all required parent directories when adding new folders.

…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.
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Mar 16, 2026

Walkthrough

Modified folder creation logic in the collection parser to use mkdirSync with { recursive: true }, enabling automatic creation of intermediate parent directories for nested folders instead of failing when parents don't exist.

Changes

Cohort / File(s) Summary
Collection Folder Creation
packages/bruno-electron/src/ipc/collection.js
Updated mkdirSync call to include { recursive: true } option, allowing nested folder hierarchies to be created automatically.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~2 minutes

Suggested labels

size/S

Suggested reviewers

  • helloanoop
  • lohit-bruno
  • naman-bruno
  • bijin-bruno

Poem

📁 Recursion flows through nested dreams,
Directories spawn in gleaming streams,
One line changed, yet pathways freed,
Parent folders planted like a seed. ✨

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title directly describes the fix: resolving EEXIST error during OpenAPI collection imports with paths folder arrangement, which matches the core change of adding { recursive: true } to mkdirSync.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
📝 Coding Plan
  • Generate coding plan for human review comments

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Tip

CodeRabbit can generate a title for your PR based on the changes.

Add @coderabbitai placeholder anywhere in the title of your PR and CodeRabbit will replace it with a title based on the changes in the PR. You can change the placeholder by changing the reviews.auto_title_placeholder setting.

@bijin-bruno bijin-bruno merged commit 590a5a9 into usebruno:main Mar 24, 2026
9 checks passed
@bijin-bruno
Copy link
Copy Markdown
Collaborator

@abhishek-bruno Please update playwright tests to cover this scenario

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants