Skip to content

[noskills] Codex integration throws EEXIST error if .codex directory already exists #127

@salihdev0

Description

@salihdev0

Bug Description

When initializing a project using the noskills init command, the process crashes with an EEXIST error if a .codex directory already exists in the project root.

This occurs after selecting "Codex CLI" in the tools selection step. It appears the CLI attempts to create the .codex directory using mkdir without first checking if the directory is already present, causing the initialization to fail.

Steps to Reproduce

  1. Ensure a .codex folder already exists in your target project directory.
  2. Run npx eser@latest noskills init
  3. When prompted for "Any additional tools?", select Codex CLI.
  4. Proceed through the remaining prompts (e.g., project kind).
  5. See the EEXIST error crash the process.

Error Output:

node:internal/fs/promises:859
  return await PromisePrototypeThen(
         ^

Error: EEXIST: file already exists, mkdir '/Users/ssi/projects/rswy/web/.codex'
    at async Module.mkdir (node:internal/fs/promises:859:10)
    at async Object.mkdir (file:///Users/ssi/.npm/_npx/4c89fca78fe8d356/node_modules/eser/chunks/chunk-TW23CULJ.js:2:1187)
    at async Object.syncHooks (file:///Users/ssi/.npm/_npx/4c89fca78fe8d356/node_modules/eser/chunks/chunk-4JICYXYK.js:102:342)
    at async wt (file:///Users/ssi/.npm/_npx/4c89fca78fe8d356/node_modules/eser/chunks/chunk-4JICYXYK.js:111:1175)
    at async Module.qe (file:///Users/ssi/.npm/_npx/4c89fca78fe8d356/node_modules/eser/chunks/init-4Q4HAHND.js:2:4759)
    at async #F (file:///Users/ssi/.npm/_npx/4c89fca78fe8d356/node_modules/eser/chunks/chunk-RNFCAHVL.js:89:34)
    at async t.parse (file:///Users/ssi/.npm/_npx/4c89fca78fe8d356/node_modules/eser/chunks/chunk-RNFCAHVL.js:88:2108)
    at async h (file:///Users/ssi/.npm/_npx/4c89fca78fe8d356/node_modules/eser/eser.js:3:13094)
    at async file:///Users/ssi/.npm/_npx/4c89fca78fe8d356/node_modules/eser/eser.js:3:13137 {
  errno: -17,
  code: 'EEXIST',
  syscall: 'mkdir',
  path: '/Users/ssi/projects/rswy/web/.codex'
}

Expected Behavior

The initialization process should gracefully handle the scenario where the .codex directory already exists. It should either bypass the directory creation step and utilize the existing folder, or output a friendly warning/prompt to the user, rather than throwing an unhandled exception and crashing the entire setup.

Actual Behavior

The initialization process crashes completely with an unhandled EEXIST error (Error: EEXIST: file already exists, mkdir...) when it attempts to create the .codex directory without verifying if it is already present in the file system.

Runtime

Node.js

Package Version

latest

Runtime Version

v24.15.0

Additional Context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingtriageNeeds triage

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions