# Failed to setup APM - yaml: line 159: did not find expected key

**URL:** <https://discuss.elastic.co/t/failed-to-setup-apm-yaml-line-159-did-not-find-expected-key/241575>\
**Category:** APM\
**Created:** [July 17, 2020, 4:30am UTC](https://discuss.elastic.co/t/failed-to-setup-apm-yaml-line-159-did-not-find-expected-key/241575 "2020-07-17T04:30:33Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![GraceYu](https://avatars.discourse-cdn.com/v4/letter/g/dbc845/32.png) [@GraceYu](https://discuss.elastic.co/u/GraceYu)\
**Post date:** [July 17, 2020, 4:30am UTC](https://discuss.elastic.co/t/failed-to-setup-apm-yaml-line-159-did-not-find-expected-key/241575/1 "2020-07-17T04:30:33Z")

</div>

Hi,

I have failed to setup APM.

./apm-server setup  
Exiting: error loading config file: yaml: line 159: did not find expected key

The following is the yml file:  
output.elasticsearch:  
hosts: [":9200"]  
username: "elastic"  
password: "password"

The following executed ok:  
curl -XGET 'http://:9200/\_all/\_search?q=\*&pretty' -u elastic:password

Please guide me for any recommendation. Thanks.

Version:  
elasticsearch-7.8.0  
kibana-7.6.0  
apm-server-7.8.0

---

<div class="post-metadata">

**Author:** ![axw](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/axw/32/28197_2.png) [@axw](https://discuss.elastic.co/u/axw)\
**Post date:** [July 17, 2020, 5:16am UTC](https://discuss.elastic.co/t/failed-to-setup-apm-yaml-line-159-did-not-find-expected-key/241575/2 "2020-07-17T05:16:41Z")

</div>

I'm not familiar with this specific error, but it sounds like there's a problem with the YAML formatting, perhaps to do with whitespace.

Can you please either paste the config as pre-formatted text (use the "\</\>" formatting option in Discuss), or paste it into [https://pastebin.com/](https://pastebin.com/) or a similar service.

---

<div class="post-metadata">

**Author:** ![GraceYu](https://avatars.discourse-cdn.com/v4/letter/g/dbc845/32.png) [@GraceYu](https://discuss.elastic.co/u/GraceYu)\
**Post date:** [July 17, 2020, 5:29am UTC](https://discuss.elastic.co/t/failed-to-setup-apm-yaml-line-159-did-not-find-expected-key/241575/3 "2020-07-17T05:29:13Z")

</div>

Hi axw,

I think the problem is I am not using X-Pack secured version of Elastic Stack. I just removed the settings.

---

<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:** [August 7, 2020, 1:29am UTC](https://discuss.elastic.co/t/failed-to-setup-apm-yaml-line-159-did-not-find-expected-key/241575/4 "2020-08-07T01:29:16Z")

</div>

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