Skip to content
This repository was archived by the owner on Aug 3, 2026. It is now read-only.

Repository files navigation

CodeBuddy Login Fix for Windows

简体中文

A small, reversible fix for CodeBuddy Code CLI login failures on Windows:

Login failed: TypeError: Cannot read properties of undefined (reading 'protocol')
Failed to login. Press esc to return to login

This issue can appear after selecting Chinese Site, especially on Windows 11 machines using Clash, Mihomo, Clash Party, or another system proxy.

Quick fix

Open PowerShell and run:

git clone https://github.com/diyqiao/codebuddy-login-fix-windows.git
cd codebuddy-login-fix-windows
powershell -ExecutionPolicy Bypass -File .\fix-codebuddy-login.ps1

Then close every CodeBuddy process and terminal window. Open a new PowerShell window:

codebuddy

Select Chinese Site and press Enter.

What the script changes

The script adds these CodeBuddy endpoints to the user-level NO_PROXY and no_proxy variables:

copilot.tencent.com
staging-copilot.tencent.com
galileotelemetry.tencent.com

It preserves existing entries, creates a backup, and checks the China authentication endpoint. It does not collect credentials, modify CodeBuddy tokens, disable Clash, or change the Windows system proxy.

Backup location:

%LOCALAPPDATA%\CodeBuddyLoginFix\env-backup.json

To restore the previous values:

powershell -ExecutionPolicy Bypass -File .\restore-codebuddy-login-env.ps1

Why this works

In the reproduced environment, CodeBuddy Code CLI v2.129.0 failed before sending the authentication request when its Windows proxy path was used. The same China authentication endpoint returned HTTP 200 when accessed directly. Bypassing the proxy only for CodeBuddy authentication endpoints avoided the failing proxy parsing path while leaving the system proxy enabled.

This repository documents an observed workaround, not an official Tencent patch. A later CodeBuddy release may fix the underlying proxy handling.

Manual fix

If you do not want to run the script:

$current = [Environment]::GetEnvironmentVariable('NO_PROXY', 'User')
$value = "$current,copilot.tencent.com,staging-copilot.tencent.com,galileotelemetry.tencent.com"
[Environment]::SetEnvironmentVariable('NO_PROXY', $value.Trim(','), 'User')
[Environment]::SetEnvironmentVariable('no_proxy', $value.Trim(','), 'User')

Restart all terminals afterward.

Diagnostics

codebuddy --version
node --version
[Environment]::GetEnvironmentVariable('NO_PROXY', 'User')
Test-NetConnection copilot.tencent.com -Port 443

CodeBuddy logs are normally stored under:

%USERPROFILE%\.codebuddy\logs

Before opening an issue, remove tokens, usernames, local paths, trace IDs, and other private data from logs.

Search terms

CodeBuddy cannot login, CodeBuddy login failed, CodeBuddy Chinese Site login, CodeBuddy China login, CodeBuddy protocol undefined, Cannot read properties of undefined reading protocol, Tencent CodeBuddy CLI, Windows 11, PowerShell, Clash, Clash Party, Mihomo, proxy, OAuth.

License

MIT

About

Fix CodeBuddy CLI Chinese Site login errors on Windows with Clash/Mihomo proxies

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages