Docker integration - unable to uninstall agent

Hey there!

Im running elastic on-prem 8.18.1 with fleet-managed agents
one of the policies running docker integration with a condition:

stringContains(${docker.container.name}, "containerName")

The integration with the condition is working.

The problem is that when I'm trying to uninstall an agent using elastic-agent uninstall or elastic-agent install --force (reinstallation) I'm getting the following error:

[ ===] Failed to uninstall agent  [0s] Error uninstalling. Printing logs
2025-05-26T18:32:54.207Z	DEBUG	[uninstall.state_migration]	not attempting to migrate from action store: state store already exists
2025-05-26T18:32:54.542Z	DEBUG	[uninstall.state_migration]	not attempting to migrate from action store: state store already exists
Error: error uninstalling agent: error uninstalling components: error applying dynamic inputs: error unpacking subarray in config for skip key inputs: expected ',' when parsing 'stringContains(${docker.container.name}, "containerName")' accessing 'inputs.8' 
For help, please see our troubleshooting guide at https://www.elastic.co/guide/en/fleet/8.18/fleet-troubleshooting.html
[====] Uninstall failed  [0s] Error: failed to uninstall elastic-agent: exit status 1
For help, please see our troubleshooting guide at https://www.elastic.co/guide/en/fleet/8.18/fleet-troubleshooting.html

The agents are running on Ubuntu 24 servers, with kibana, agents, Elastic, and fleet all running the same versions.
I'm using Docker-Compose in order to run fleet, elastic, and kibana

The installation process is working fine

After removing the condition from the integration, I'm able to uninstall successfully

How can i safely uninstall or reinstall the agents without removing the condition? Is it a bug?

Hi @gaimes410

Per the docs

Are you running the command from outside in the install directory with the full path?

sudo /opt/Elastic/Agent/elastic-agent uninstall

Otherwise it will not uninstall properly...

Hey, thanks for the quick response!
Yeah I've followed the guide correctly and as I've said, removing the agent was possible again after deleting the condition from the integration.

Yeah that is weird... seems like a bug of some sort

I have opened an issue on github on the matter