# \[elastic\_agent\]\[error\] Cannot checkin in with fleet-server, retrying

**URL:** <https://discuss.elastic.co/t/elastic-agent-error-cannot-checkin-in-with-fleet-server-retrying/351595>\
**Category:** Elastic Agent\
**Created:** [January 23, 2024, 6:52am UTC](https://discuss.elastic.co/t/elastic-agent-error-cannot-checkin-in-with-fleet-server-retrying/351595 "2024-01-23T06:52:55Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![AnkurYogi](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ankuryogi/32/121279_2.png) [@AnkurYogi](https://discuss.elastic.co/u/AnkurYogi)\
**Post date:** [January 23, 2024, 6:52am UTC](https://discuss.elastic.co/t/elastic-agent-error-cannot-checkin-in-with-fleet-server-retrying/351595/1 "2024-01-23T06:52:55Z")

</div>

Hi everyone

All my agents are showing offline and I am not sure why.  
Here are some logs and info to start the discussion..!

 ![fleet](https://us1.discourse-cdn.com/elastic/original/3X/7/3/73b1474f9698a5af2d51ef61821495459ff00e3a.png)  
 ![fleet2](https://us1.discourse-cdn.com/elastic/original/3X/8/7/879cd75423e67055be7f9cc97f070a882b234edc.png)

```auto
{
"log.level": "info",
"@timestamp": "2024-01-23T06:21:39.097Z",
"message": "ApiKey fail authentication",
"component": {
"binary": "fleet-server",
"dataset": "elastic_agent.fleet_server",
"id": "fleet-server-default",
"type": "fleet-server"
},
"log": {
"source": "fleet-server-default"
},
"service.type": "fleet-server",
"server.address": "",
"ecs.version": "1.6.0",
"[service.name](http://service.name)": "fleet-server",
"[http.request.id](http://http.request.id)": "01HMTFN464ZQ2G3J9DJF37W6GT",
"error.message": "unauthorized: apikey auth response 5iaUM4wBn1bodLGK1xXo: [401 Unauthorized] {\"error\":{\"root_cause\":[{\"type\":\"security_exception\",\"reason\":\"unable to authenticate with provided credentials and anonymous access is not allowed for this request\",\"additional_unsuccessful_credentials\":\"API key: unable to find apikey with id 5iaUM4wBn1bodLGK1xXo\",\"header\":{\"WWW-Authenticate\":[\"Basic realm=\\\"security\\\" charset=\\\"UTF-8\\\"\",\"Bearer realm=\\\"security\\\"\",\"ApiKey\"]}}],\"type\":\"security_exception\",\"reason\":\"unable to authenticate with provided credentials and anonymous access is not allowed for this request\",\"additional_unsuccessful_credentials\":\"API key: unable to find apikey with id 5iaUM4wBn1bodLGK1xXo\",\"header\":{\"WWW-Authenticate\":[\"Basic realm=\\\"security\\\" charset=\\\"UTF-8\\\"\",\"Bearer realm=\\\"security\\\"\",\"ApiKey\"]}},\"status\":401}",
"[fleet.apikey.id](http://fleet.apikey.id)": "5iaUM4wBn1bodLGK1xXo",
"event.duration": 2653200
}

```

---

<div class="post-metadata">

**Author:** ![yago82](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/yago82/32/97755_2.png) [@yago82](https://discuss.elastic.co/u/yago82)\
**Post date:** [January 23, 2024, 8:34am UTC](https://discuss.elastic.co/t/elastic-agent-error-cannot-checkin-in-with-fleet-server-retrying/351595/2 "2024-01-23T08:34:58Z")

</div>

> [@AnkurYogi](#):
>
> All my agents are showing offline and I am not sure why.  
> Here are some logs and info to start the discussion..!
> 
> ![fleet](https://us1.discourse-cdn.com/elastic/original/3X/7/3/73b1474f9698a5af2d51ef61821495459ff00e3a.png)
> 
> ![fleet2](https://us1.discourse-cdn.com/elastic/original/3X/8/7/879cd75423e67055be7f9cc97f070a882b234edc.png)
> 
> ```auto
> {
> "log.level": "info",
> "@timestamp": "2024-01-23T06:21:39.097Z",
> "message": "ApiKey fail authentication",
> "component": {
> "binary": "fleet-server",
> "dataset": "elastic_agent.fleet_server",
> "id": "fleet-server-default",
> "type": "fleet-server"
> },
> "log": {
> "source": "fleet-server-default"
> },
> "service.type": "fleet-server",
> "server.address": "",
> "ecs.version": "1.6.0",
> "[service.name](http://service.name)": "fleet-server",
> "[http.request.id](http://http.request.id)": "01HMTFN464ZQ2G3J9DJF37W6GT",
> "error.message": "unauthorized: apikey auth response 5iaUM4wBn1bodLGK1xXo: [401 Unauthorized] {\"error\":{\"root_cause\":[{\"type\":\"security_exception\",\"reason\":\"unable to authenticate with provided credentials and anonymous access is not allowed for this request\",\"additional_unsuccessful_credentials\":\"API key: unable to find apikey with id 5iaUM4wBn1bodLGK1xXo\",\"header\":{\"WWW-Authenticate\":[\"Basic realm=\\\"security\\\" charset=\\\"UTF-8\\\"\",\"Bearer realm=\\\"security\\\"\",\"ApiKey\"]}}],\"type\":\"security_exception\",\"reason\":\"unable to authenticate with provided credentials and anonymous access is not allowed for this request\",\"additional_unsuccessful_credentials\":\"API key: unable to find apikey with id 5iaUM4wBn1bodLGK1xXo\",\"header\":{\"WWW-Authenticate\":[\"Basic realm=\\\"security\\\" charset=\\\"UTF-8\\\"\",\"Bearer realm=\\\"security\\\"\",\"ApiKey\"]}},\"status\":401}",
> "[fleet.apikey.id](http://fleet.apikey.id)": "5iaUM4wBn1bodLGK1xXo",
> "event.duration": 2653200
> }
> 
> ```

Hi,

check if the API key was deleted from Elasticsearch or the API key is expired.

Regards

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [February 20, 2024, 11:55am UTC](https://discuss.elastic.co/t/elastic-agent-error-cannot-checkin-in-with-fleet-server-retrying/351595/4 "2024-02-20T11:55:06Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
