Bamboo remote agent installation on a Linux server fails with "query did not return a unique result: 3"
Platform Notice: Data Center Only - This article only applies to Atlassian products on the Data Center platform.
Note that this KB was created for the Data Center version of the product. Data Center KBs for non-Data-Center-specific features may also work for Server versions of the product, however they have not been tested. Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.
*Except Fisheye and Crucible
Summary
Bamboo remote agent installation on a Linux server fails to start with the below error in the <Bamboo-Agent-Home>/atlassian-bamboo-agent.log file while registering the agent name on the Bamboo server:
1
2
2023-05-07 12:11:58,188 INFO [AgentRunnerThread] [AgentRegistrationBean] Registering agent on the server,
2023-05-07 12:11:58,484 WARN [AgentRunnerThread] [AbstractApplicationContext] Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'agentRegistrationBean': Invocation of init method failed; nested exception is org.springframework.dao.IncorrectResultSizeDataAccessException: query did not return a unique result: 3; nested exception is org.hibernate.NonUniqueResultException: query did not return a unique result: 3
Environment
All supported versions of Bamboo with remote agents
Diagnosis
Check if any other old agents using the same name shown in the error stack trace(it is "test.agent.jk" for this case) using the below SQL query:
1
select * from queue;
queue table in Bamboo database consists of data related to agents like title(agent name), agent_type, agent_description, created_date, enabled etc.
The agent name will be under the title column from the above queue table. Using this title column values check if any old agents(online or offline) available in Bamboo with the same domain name as the issue agent(which fails to startup).
Cause
It fails as Bamboo is unable to find a Unique agent name to register for the agent. The remote agent is not able to start because of any available agent with the same domain namein the Bamboo database.
Solution
As per the details found in the queue table:
If any Offline remote agent is found with the same name: Delete the old agents (if not required) via the Offline Remote Agents webpage from the Bamboo Overview > Agents> Remote Agents > Offline Remote Agents tab and the new agents will start successfully.
If any Online remote agent is found with the same name: Use a unique name for the new agent to be started otherwise it will cause an issue while registering the new agent on the Bamboo server.
Was this helpful?