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
- Install poe-code globally on Windows: npm install -g poe-code
- 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.
Environment
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
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:
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.