Skip to content

The interface shows "query failed" - cc-switch

Quick fix

Upgrade past v3.16.2 for the query routing fix, or use a custom balance query template. Put hooks in general config, and raise the failover timeout.

Error output
界面显示「查询失败」
English translation

The interface shows "query failed"

This mostly comes from how cc-switch rewrites config and routes endpoints when switching provider. For Zhipu GLM, early versions hard-coded the balance query endpoint, so parsing failed when using open.bigmodel.cn and the interface showed a query error — without affecting actual API forwarding. On top of that, cc-switch switches config by rewriting setting.json rather than replacing individual entries, so hooks and similar parameters are lost unless written into 通用配置 (general config).

With automatic failover on, a badly set streaming/non-streaming timeout threshold can upset the context mechanism and overwrite the model config wrongly (a GLM config turning into mimo, for example). For other tools such as Hermes, a top-level model.provider missing the custom: prefix after a switch also leaves it not applying in practice.

  1. Upgrade cc-switch to v3.16.2 or newer for the Zhipu GLM balance query endpoint routing fix.

  2. If it still errors after upgrading, configure the query endpoint with a custom template in the provider settings: point the request URL at https://bigmodel.cn/api/monitor/usage/quota/limit and write an extractor function to parse the remaining and usage fields.

  3. Write hooks and any other config every provider needs into 通用配置 (general config) and tick it, so the config file rewrite on a switch cannot lose them.

    // setting.json
    {
    "hooks": {
    // 请确保在 cc-switch 的“通用配置”中编辑并勾选此项
    }
    }
  4. With automatic failover on, raise the streaming and non-streaming timeout thresholds in settings so a timeout does not scramble the config context. If it already happened, close the old terminal window and open a new one to clear the context.

Toolcc-switch
Version3.9.0 - 3.16.5
PlatformsWindowsmacOS
Why does the interface say query failed while the API actually works?
Query failed only means the response format did not match, or the routing was wrong, when cc-switch called the Zhipu balance/usage query endpoint. It does not affect API request forwarding in the proxy layer.
Why did the hooks I configured disappear after switching provider?
That is expected. To stop parameters from different providers polluting each other, cc-switch rewrites setting.json on a switch. Put hooks into 通用配置 (general config) and tick it while editing.
Why did my GLM config turn into another model after enabling automatic failover?
A streaming/non-streaming failover timeout threshold set too low can upset the context mechanism. Raise the thresholds, and try closing the old terminal window and opening a new one to clear the context.

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.