Fleet server went offline

Fleet agent went offline after adding elasticsearch ,kibana integration to the fleet server policy.

But while trying to add server after uninstalling the agent but it is not uninstalling and giving error

2025-07-19T19:47:39.590Z DEBUG [uninstall] Creating new request to request URL https://localhost:8221/api/fleet/agents/05258dca-4d90-4b8f-bac1-c8b5aa221a28/audit/unenroll?
2025-07-19T19:47:39.593Z DEBUG [uninstall] requester 0/1 to host https://localhost:8221/ errored {"error": "Post \"https://localhost:8221/api/fleet/agents/05258dca-4d90-4b8f-bac1-c8b5aa221a28/audit/unenroll?\": dial tcp 127.0.0.1:8221: connect: ```
connection refused"}
2025-07-19T19:47:49.853Z 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 '${host.os_version} != "12 (bookworm)" and (${host.os_platform} != "amzn" or ${host.os_version} != "2023") and (${host.os_platform} != "sles" and startsWith(${host.os_version}, "15") == false)' accessing 'inputs.0'
For help, please see our troubleshooting guide at [https://www.elastic.co/guide/en/fleet/8.18/fleet-troubleshooting.html(external, opens in a new tab or window)](https://www.elastic.co/guide/en/fleet/8.18/fleet-troubleshooting.html)
[root@vfralapelknpd01 elastic-agent-8.18.1-linux-x86_64]#

Please suggest

Hi, do you see any errors in fleet-server logs when it went unhealthy?

This should help with the uninstall error: Elastic Support Hub