Skip to content

fix(memory): avoid Bun Windows EEXIST on startup memory dir mkdir#243

Draft
virattt wants to merge 1 commit into
mainfrom
cursor/fix-memory-mkdir-windows-e23c
Draft

fix(memory): avoid Bun Windows EEXIST on startup memory dir mkdir#243
virattt wants to merge 1 commit into
mainfrom
cursor/fix-memory-mkdir-windows-e23c

Conversation

@virattt

@virattt virattt commented May 3, 2026

Copy link
Copy Markdown
Owner

Summary

  • add a shared ensureDirectory() helper that safely handles Bun-on-Windows mkdir(..., { recursive: true }) throwing EEXIST for already-existing directories
  • use this helper in memory initialization/write paths:
    • MemoryStore.ensureDirectoryExists()
    • MemoryStore.writeMemoryFile() parent directory creation
    • MemoryDatabase.create() parent directory creation
  • add regression tests for ensureDirectory() behavior when target already exists, is missing, and is a file

Why

Issue #242 reports:

  • Error: EEXIST: file already exists, mkdir '.dexter\\memory'

Dexter currently calls recursive mkdir on startup for .dexter/memory. On affected Bun/Windows versions, this can throw EEXIST even when the directory already exists, causing memory initialization to fail before the existing fallback handling.

Validation

  • static review of affected call sites completed
  • unable to execute bun run typecheck / bun test in this cloud environment because bun is not installed (bun: command not found)

Risk

Low. Changes are limited to directory creation behavior and preserve existing failure semantics for non-directory collisions.

Open in Web Open in Cursor 

Co-authored-by: Virat Singh <virattt@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants