Skip to content

Circular extends detected in config.json on Windows blocks all commands #270

@DravenYe

Description

@DravenYe

Environment

  • OS: Windows 11
  • poe-code version: 3.0.198 (global install)
  • Node.js: (run node -v to check)

Description

On Windows, every command (login, configure, wrap, etc.) fails with a Circular extends detected error referencing
~/.poe-code/config.json visiting itself twice. The error occurs even when config.json is empty ({}) or deleted entirely — the tool
recreates and immediately detects a circular reference in it.

Steps to Reproduce

  1. Install poe-code globally on Windows: npm install -g poe-code
  2. Run any command, e.g. poe-code login or poe-code configure

Error Output

■ Error: Circular extends detected.
│ Visited files:
│ - C:\Users<user>.poe-code\config.json
│ - C:\Users<user>.poe-code\config.json

Root Cause (identified)

In resolveBaseChain (packages/config-extends/src/resolve.ts), when the discovered base file path is already in the visited set, the
code unconditionally throws — even when optional is true (i.e. no explicit extends field in the document). The fix is to respect the
optional flag:

if (visited.has(discoveredBase.filePath)) {
  • if (optional) return void 0;
    throw new Error(
    Circular extends detected.\nVisited files:\n- ${[...visited, discoveredBase.filePath].join("\n- ")}
    );
    }

This one-line fix resolves the issue on Windows.

Workaround

Manually apply the above patch to the installed dist/index.js.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions