Stumbling upon error trying to authenticate on Windows, see logs below.
git clone https://github.com/gemini-cli-extensions/workspace
cd workspace
npm install
# prints OAuth URL, then:
# Login failed: ENOENT: no such file or directory, open 'L:\workspace\CON'
npm run auth-utils -- login
From what I understand, CON is a Windows special name referring to the console device, and it seems Node.js resolves it to a literal relative path instead of this device, leading to this.
Minimal repro (run from any directory on Windows):
const fs = require('fs');
console.log('before:', fs.existsSync('CON') ? 'CON exists' : 'CON does not exist'); // before: CON does not exist
fs.writeFileSync('CON', 'test');
console.log('after: ', fs.existsSync('CON') ? 'CON exists' : 'CON does not exist'); // after: CON exists
if (fs.existsSync('CON')) {
console.log('BUG: literal CON file created'); // BUG: literal CON file created
fs.unlinkSync('CON');
} else {
console.log('OK: wrote to console device');
}
console.log('end: ', fs.existsSync('CON') ? 'CON exists' : 'CON does not exist'); // end: CON does not exist
Tested on Node.js v24.14.0, Windows 11.
Introduced in #227, ping @allenhutchison
Fix
Use \\.\CON — the Windows device namespace prefix — which bypasses path resolution entirely and always resolves to the real console device, regardless of CWD or drive type:
Submitted as a PR in #297
function openTtyRead(): fs.ReadStream {
- const ttyPath = os.platform() === 'win32' ? 'CON' : '/dev/tty';
+ const ttyPath = os.platform() === 'win32' ? '\\\\.\\CON' : '/dev/tty';
return fs.createReadStream(ttyPath, { encoding: 'utf8' });
}
function openTtyWrite(): fs.WriteStream {
- const ttyPath = os.platform() === 'win32' ? 'CON' : '/dev/tty';
+ const ttyPath = os.platform() === 'win32' ? '\\\\.\\CON' : '/dev/tty';
return fs.createWriteStream(ttyPath);
}
Stumbling upon error trying to authenticate on Windows, see logs below.
From what I understand,
CONis a Windows special name referring to the console device, and it seems Node.js resolves it to a literal relative path instead of this device, leading to this.Minimal repro (run from any directory on Windows):
Tested on Node.js v24.14.0, Windows 11.
Introduced in #227, ping @allenhutchison
Fix
Use
\\.\CON— the Windows device namespace prefix — which bypasses path resolution entirely and always resolves to the real console device, regardless of CWD or drive type:Submitted as a PR in #297
function openTtyRead(): fs.ReadStream { - const ttyPath = os.platform() === 'win32' ? 'CON' : '/dev/tty'; + const ttyPath = os.platform() === 'win32' ? '\\\\.\\CON' : '/dev/tty'; return fs.createReadStream(ttyPath, { encoding: 'utf8' }); } function openTtyWrite(): fs.WriteStream { - const ttyPath = os.platform() === 'win32' ? 'CON' : '/dev/tty'; + const ttyPath = os.platform() === 'win32' ? '\\\\.\\CON' : '/dev/tty'; return fs.createWriteStream(ttyPath); }