Agent status is ready but docker agent is throwing error 409

Hi All,
I see the agent status is ready but in the docker container I see the error
Error code: 409
Request ID: JKJ2J6Eb
Error message: Agent with alias [] already exists in the account

Has anyone faced the same issue?
Can you please let me know how to fix it?

Thank you.

facing same issue, really annoying. Have to remove the agents from testproject everytime and afterworth it will start working again but also need to link our jobs again with the agents.

Yes, I did the same by removing the agent and scheduling the tests again!! :frowning_face:
But now it looks fine, at least from past 3 days I did not get that issue.

From yesterday again I see the same issue. :frowning_face:

Testproject team can you please raise a bug and fix this issue?
Thank you.

We worked around it by adding a random string to the agent name on each run.

entrypoint-wrapper.sh (don’t forget to run chmod +x)

#!/bin/sh

# Script to try to avoid the error "Agent with alias june-demo.funatic.nl already exists in the account"
# https://forum.testproject.io/t/agent-status-is-ready-but-docker-agent-is-throwing-error-409/12601

random_string=$(echo $RANDOM | md5sum | head -c 8)

TP_AGENT_ALIAS="$TP_AGENT_ALIAS ($random_string)" /opt/testproject/agent/entrypoint.sh

Dockerfile:

FROM testproject/agent:latest

COPY entrypoint-wrapper.sh /opt/testproject/agent/

ENTRYPOINT /opt/testproject/agent/entrypoint-wrapper.sh

This will, however, create a lot of agents, but in our case that doesn’t seem to matter.

yeah, it will create many test agents.

I did create a test to schedule all the jobs, so whenever agent needs to be recreated I will execute the tests.

It’s annoying. Once I was able to fix it using:

│     - name: TP_AGENT_TEMP                                                                                                                                                                  │
│       value: "true"

But now it doens’t help at all. So the local k8s agent is pretty much useless, since it can be terminated by multiple reasons and fails to recreate because of this stupid error.