Agent connected but Unauthorized with comment: Agent authorization token does not match the stored one.

TC v8.1.3

I've reinstalled the agent, no luck,

Stopped the agent, opened the properties file on the agent machine, deleted the token line & then restarted the agent.  Saw the new token but still, no luck.

Any other ideas or places I can look?


Comment actions Permalink

ok... had one more ideer and it worked:

uninstalled the agent on the server, went to the TC page & REMOVED the agent from the site.  then went back and re-installed...

we are all up and running now..


Comment actions Permalink

I bumped into this issue as well. It is not needed to fully reinstall either the agent or the server, nor editing the buildagent properties file to remove the token line. It was sufficient to

- stop the agent

- unauthorize (and disable it)

- remove it on the web interface

- start the agent

- authorize agent on server side

Comment actions Permalink

And the issue recurred again (every week once). Currently we apply the following "process":

- on the agent machine in conf/ remove the authorization token line (agent does not need to be stopped)

- agent will restart itself (above TC 8), registers itself, and asks for a new authorization token from the server, saves it to conf/

- ask a teamcity system administrator to reauthorize agent

Comment actions Permalink

Hello Kottalovag,

When does this issue happen? This problem can occur if authorization token (or the whole file) changes. In this case when agent with the same name comes to server with different token, you can see this error.

Comment actions Permalink

Hello Alina,

Thanks for your response!

The backstory: this issue happens with TeamCity 8.1.3 with an agent of Linux 3.16.0-31-generic.
We had a base image which works fine. We asked our IT guys to create 3 exact image clones of it. We changed each to have different agent names, started the agents and authorized each them. The funny thing: 2 of these copies and the original teamcity agent work seamlessly, but the 3rd copy does this every now and then. 

As written above, I tried to remove the auth token. The agent asked for a new one from the server, and it got the new token, saved to its agent props file. The agent host names are different as well (so we changed agent name and the host name of the machines themselves).

This is critical btw as we are about to host our agent machine images from docker in the very near future.

Can you give me some pointers? :)


Comment actions Permalink


Could you please attach teamcity-agent.log file? You can use "Submit a request" button to create a private ticket.

Comment actions Permalink

Hello Mishina, 

thanks for the respon, sorry for the big delay. Our IT found out there was a zombie machine with the same name returning every now and then to mess up the IP-s and got off again... Once they have deleted that instance the issue did not arise again.

Comment actions Permalink


We have the same issue

Build was canceled with comment: Agent unauthorized: ASG agent unregistered` at 16:14

In teamcity-agent.log i see

[2020-01-20 16:14:19,870] INFO - buildServer.AGENT.registration - Registered on server with id 14804 and authorization token '***' config looks like

# Agent Properties


after that the agent works well.

Help me please how to understand what happened for prevent this in future?


Please sign in to leave a comment.