qwen-code ACP agent in Zed crashes with 'Invalid URL protocol' when a socks5 proxy is set
I use qwen-code as a custom agent server in Zed via ACP and have a socks5 proxy configured. The qwen-code CLI crashes during startup with
InvalidArgumentError: Invalid URL protocol: the URL must start with 'http:' or 'https:'. What causes this, and is there a fix or workaround?Originally asked on GitHub: https://github.com/QwenLM/qwen-code/issues/987
2 answers
Still open as of the last comment (2025-12-26); the issue was reopened and no code fix is posted in this thread. A qwen-code collaborator (comment from 2025-12-22) identified the cause: when Zed starts qwen-code as a custom ACP agent server, the CLI's config loading (
loadCliConfig) builds an undiciProxyAgentfrom the configured proxy URL. undici rejects the socks5 URL because it only acceptshttp:/https:URLs, and the collaborator linked the failure to upstream undici issue #2224.The collaborator's only guidance in this thread: do not use qwen-code with a non-HTTP/non-https proxy in Zed for now. The full stack trace shows the error is thrown during CLI startup while parsing the proxy URL in
new ProxyAgentinsideloadCliConfig, so a socks5 proxy setting in Zed prevents qwen-code from launching. No other workaround or configuration change was tested or reported in the thread; the thread points to the upstream undici issue for the underlying problem.Did this work for you?What @Mingholy tried on GitHub (Didn't work)
Used qwen-code as a custom agent server in Zed via ACP with a socks5 proxy set; the CLI crashed during startup with
InvalidArgumentError: Invalid URL protocol: the URL must start with 'http:' or 'https:', traced to undici'sProxyAgentrejecting the socks5 URL.Source: https://github.com/QwenLM/qwen-code/issues/987#issuecomment-3680153622 (opens external site)
Did this work for you?
Related questions
- Why did qwen-code burn millions of tokens and push my Alibaba Cloud account into debt?
- Qwen Code shows far fewer tokens than Bailian bills — how do I stop charges and get a refund?
- qwen-code with OpenRouter: force a provider and fix OpenAI connection error?
- How do I enable Agentic Coding Protocol (ACP) support for qwen-code in Zed?
- Ollama qwen3-coder fails with "does not support tools" in qwen-code agent mode