azure-devopsazure-devops-self-hosted-agent

The proxy url is not a well formed absolute uri string Error from Azure agent


I self-host an agent on a stock Ubuntu 22.04. It runs behind a proxy and was running fine. Today the agent went offline in the web interface. The agent's version is 3.220.0.

Upon manually starting ./runsvc.sh on the agent (via systemd in my case), it shows an error. The log in _diag says:

[2023-12-13 08:50:48Z INFO HostContext] Well known config file 'Proxy': '/home/mo/azure-agent/.proxy'
[2023-12-13 08:50:48Z ERR  VstsAgentWebProxy] The proxy url is not a well formed absolute uri string: "http://proxy.domain.com:SOME_PORT".
[2023-12-13 08:50:48Z INFO VstsAgentWebProxy] No proxy setting found.

Nothing shows up for this error on the internet.

I'm currently trying to understand the code where the error comes from, see line 156 private void LoadProxySetting(). It seems something is wrong with the file URI.

(All paths are relative to agent's root directory)


Solution

  • In my case the .proxy file was missing. The following fixed the error:

    echo http://proxy.domain.com:SOME_PORT > .proxy
    

    Make sure .proxy content is without any quotes.

    For internet access to work again, also check files like .env and runsvc.sh (or wherever you export your environment). I had a line export http_proxy="http://proxy.domain.com:SOME_PORT" where I also had to remove the quotes.

    Note:
    It's still unclear, why this issue only appeared after the agents were running fine for months. The root cause is still unclear, maybe some update.