# jsonfile fact caching error: error, fact\_caching\_connection is not set, cannot use fact cache

**URL:** <https://forum.ansible.com/t/jsonfile-fact-caching-error-error-fact-caching-connection-is-not-set-cannot-use-fact-cache/18892>\
**Category:** Ansible Project\
**Created:** [July 29, 2015, 7:27pm UTC](https://forum.ansible.com/t/jsonfile-fact-caching-error-error-fact-caching-connection-is-not-set-cannot-use-fact-cache/18892 "2015-07-29T19:27:46Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![senorsmile](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/senorsmile/32/9024_2.png) [@senorsmile](https://forum.ansible.com/u/senorsmile)\
**Post date:** [July 29, 2015, 7:27pm UTC](https://forum.ansible.com/t/jsonfile-fact-caching-error-error-fact-caching-connection-is-not-set-cannot-use-fact-cache/18892/1 "2015-07-29T19:27:46Z")

</div>

I have added the following to ansible.cfg

`  
fact\_caching = jsonfile  
fact\_caching\_location = /tmp/ansible\_facts  
fact\_caching\_timeout = 86400

`

With these set, any attempts to use ansible or ansible-playbook (tried multiple different known working playbooks) fails with the error:

`  
error, fact\_caching\_connection is not set, cannot use fact cache

`

I have tried this on both a mac and a linux machine.

What is wrong there?

---

<div class="post-metadata">

**Author:** ![senorsmile](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/senorsmile/32/9024_2.png) [@senorsmile](https://forum.ansible.com/u/senorsmile)\
**Post date:** [July 29, 2015, 7:28pm UTC](https://forum.ansible.com/t/jsonfile-fact-caching-error-error-fact-caching-connection-is-not-set-cannot-use-fact-cache/18892/2 "2015-07-29T19:28:12Z")

</div>

I should add that both machines are using ansible 1.9.2.

---

<div class="post-metadata">

**Author:** ![Brian\_Coca](https://avatars.discourse-cdn.com/v4/letter/b/6de8d8/32.png) [@Brian\_Coca](https://forum.ansible.com/u/Brian_Coca)\
**Post date:** [July 29, 2015, 7:37pm UTC](https://forum.ansible.com/t/jsonfile-fact-caching-error-error-fact-caching-connection-is-not-set-cannot-use-fact-cache/18892/3 "2015-07-29T19:37:56Z")

</div>

have you tried setting fact\_caching\_connection?

---

<div class="post-metadata">

**Author:** ![senorsmile](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/senorsmile/32/9024_2.png) [@senorsmile](https://forum.ansible.com/u/senorsmile)\
**Post date:** [July 29, 2015, 7:40pm UTC](https://forum.ansible.com/t/jsonfile-fact-caching-error-error-fact-caching-connection-is-not-set-cannot-use-fact-cache/18892/4 "2015-07-29T19:40:43Z")

</div>

There is no such keyword according to the docs:  
[http://docs.ansible.com/ansible/playbooks\_variables.html#fact-caching](http://docs.ansible.com/ansible/playbooks_variables.html#fact-caching)

I can’t even tell what it would want to be set to.  
jsonfile?  
/tmp/ansible\_facts?  
something else?

---

<div class="post-metadata">

**Author:** ![Brian\_Coca](https://avatars.discourse-cdn.com/v4/letter/b/6de8d8/32.png) [@Brian\_Coca](https://forum.ansible.com/u/Brian_Coca)\
**Post date:** [July 29, 2015, 7:42pm UTC](https://forum.ansible.com/t/jsonfile-fact-caching-error-error-fact-caching-connection-is-not-set-cannot-use-fact-cache/18892/5 "2015-07-29T19:42:01Z")

</div>

docs are wrong, location doesn't exist, i'll fix the docs

---

<div class="post-metadata">

**Author:** ![senorsmile](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/senorsmile/32/9024_2.png) [@senorsmile](https://forum.ansible.com/u/senorsmile)\
**Post date:** [July 29, 2015, 7:49pm UTC](https://forum.ansible.com/t/jsonfile-fact-caching-error-error-fact-caching-connection-is-not-set-cannot-use-fact-cache/18892/6 "2015-07-29T19:49:13Z")

</div>

Great. So,

` `  
fact\_caching\_location

` `

`should actually be`

`  
fact\_caching\_connection

`

This should be dumping some sort of json of cached facts into that directory, correct? When I run anything that gathers facts, the /tmp/ansible\_facts/ dir is created. However, it contains no files and no actual caching is happening.
