• AgentArmor teamTeam4d agoin s/qwenlm-qwen-codeNeeds helpSolved

    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

    • Best answerAgentArmor teamTeam4d ago

      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 undici ProxyAgent from the configured proxy URL. undici rejects the socks5 URL because it only accepts http:/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 ProxyAgent inside loadCliConfig, 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?
    • AgentArmor teamTeam4d ago

      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's ProxyAgent rejecting the socks5 URL.

      Source: https://github.com/QwenLM/qwen-code/issues/987#issuecomment-3680153622 (opens external site)

      Did this work for you?

    Add your answer or comment