Skip to content

Claude Code errors or model mapping fails with the CC Switch proxy on

Quick fix

Upgrade to v3.15.0 or newer, then set the global outbound proxy explicitly in cc-switch so a stale system proxy cannot be cached by an old process.

Error output
开启ccswitch代理后,在vscode中使用cc插件,会出现Cannot read properties of null (reading 'output_tokens')导致对话中断,但通过ccswitch的会话管理,可以看到对话其实并没有真的中断
English translation

With the ccswitch proxy on, using the cc plugin in vscode produces Cannot read properties of null (reading 'output_tokens') and the conversation breaks off — but through ccswitch's session management you can see the conversation did not actually stop.

This cluster covers several related problems in the cc-switch proxy and network layer. At their core: request forwarding, model mapping, and system proxy state sync are all unstable. The most typical, now fixed, one: with the cc-switch proxy on, the Claude Code VS Code plugin or CLI hits an empty field while reading the upstream response, so the front end reports Cannot read properties of null (reading 'output_tokens') while cc-switch session management shows the conversation still running. A maintainer confirmed this was fixed in v3.15.0.

The other variants: cc-switch does not follow the system proxy automatically, and may keep using the old proxy address after you close or switch proxy software, so you have to restart cc-switch or configure a global outbound proxy explicitly; proxy ports save incorrectly; incomplete model mapping or unregistered date aliases break routing; conflicts with Surge and similar tools on macOS; plus some unclosed issues around model pass-through, system role conversion, and image tool_result serialisation. They all belong to the proxy/network/routing path but are fixed to different degrees, so if one persists after upgrading, troubleshoot it separately.

  1. Upgrade cc-switch to v3.15.0 or newer. A maintainer confirmed that version fixes Cannot read properties of null (reading 'output_tokens') in the Claude Code plugin/CLI with the proxy on.

  2. If you use a system proxy tool such as Surge, Clash, mihomo, or v2ray, do not rely on cc-switch detecting it automatically. Fill in the address and port explicitly under 设置 -> 路由 -> 全局出站代理 (Settings > Routing > Global outbound proxy).

  3. If Claude Code requests still fail after you close or switch the system proxy, restart cc-switch so it re-reads the current network and proxy state.

  4. If the error is that a model does not exist, is not registered, or that model mapping failed, check the provider model mapping is complete — Claude Code / Claude Desktop / Cowork may request a model name with a date suffix, such as claude-haiku-4-5-20251001, which has to map to a model actually available upstream.

ToolClaude Code
Version3.12.2 - 3.16.5,其中 Cannot read properties of null (reading 'output_tokens') 已在 v3.15.0 修复
PlatformsWindowsmacOS

This page is distilled from 21 real issues

What if Cannot read properties of null (reading 'output_tokens') persists after upgrading to v3.15.0?
A maintainer asked for the original issue to be reopened with the latest version number, reproduction steps, and relevant logs, noting it may be a remnant in the new version or a different proxy-path problem.
Does cc-switch use the system proxy automatically?
Not reliably. Several issues show cc-switch may still use the old proxy after you close or switch the system one. Configure a global outbound proxy explicitly, or restart cc-switch.
The cc-switch proxy does not work with Surge on macOS. What now?
Try configuring a rule in Surge so it does not intercept cc-switch HTTP requests, or set the Surge proxy address under 设置 -> 路由 -> 全局出站代理 (Settings > Routing > Global outbound proxy). Some users have still not confirmed this fully resolved.
Is a model mapping failure, or a model-does-not-exist / no-permission error, related to the proxy?
Yes. The cc-switch proxy layer has to map the model name Claude Code requests onto one the upstream provider supports. If the mapping is incomplete, or upstream does not accept a date-suffixed model name, it surfaces as model not found, no permission, or a routing failure.

This is an unofficial community wiki with no affiliation to the cc-switch authors or the project itself. Its content is compiled from the project's public GitHub issues. This site distributes no software.