# getJSON cache raises 'file name too long'

**URL:** <https://discourse.gohugo.io/t/getjson-cache-raises-file-name-too-long/7373>\
**Category:** feature\
**Created:** [July 9, 2017, 7:28pm UTC](https://discourse.gohugo.io/t/getjson-cache-raises-file-name-too-long/7373 "2017-07-09T19:28:09Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![TheOrangeOne](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/theorangeone/32/3161_2.png) [@TheOrangeOne](https://discourse.gohugo.io/u/TheOrangeOne)\
**Post date:** [July 9, 2017, 7:28pm UTC](https://discourse.gohugo.io/t/getjson-cache-raises-file-name-too-long/7373/1 "2017-07-09T19:28:09Z")

</div>

(Mix between feature and support, thought best to post here)

When getting JSON data from an API with a very long url, the download runs fine, but if the cache path is too long, a ‘file name too long’ error is raised. I’m reasonably sure this is the OS not hugo, but this is certainly the right place to raise this!

Obviously this is a reasonably niche issue, but still one all the same, as my site wont build. Whilst i dont know how the cache for this works in hugo, I have come up with a potential solution.

If rather than using the full URL as the filename, you instead used a hash (doesnt matter which), then the filename will be far shorter, and a uniform length. Yes this does make finding a cache file much harder for a user, but for hugo to find it, it’s a minimal computational step extra.

Another alternative would be to store all cache items in a single file, but that feels a bit too weird, and would likely increase the memory footprint.

Open to suggestions, but saving the url as the filename just feels like a massive hack IMO.

---

<div class="post-metadata">

**Author:** ![bep](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/bep/32/3332_2.png) [@bep](https://discourse.gohugo.io/u/bep)\
**Post date:** [July 9, 2017, 7:41pm UTC](https://discourse.gohugo.io/t/getjson-cache-raises-file-name-too-long/7373/2 "2017-07-09T19:41:02Z")

</div>

A hash as key sounds reasonable, but it would be good if you could create an issue on GitHub to track this.

---

<div class="post-metadata">

**Author:** ![TheOrangeOne](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/theorangeone/32/3161_2.png) [@TheOrangeOne](https://discourse.gohugo.io/u/TheOrangeOne)\
**Post date:** [July 10, 2017, 8:57am UTC](https://discourse.gohugo.io/t/getjson-cache-raises-file-name-too-long/7373/3 "2017-07-10T08:57:29Z")

</div>

Commented here incase a discussion was needed, or i’d missed a setting.

Issue created: [https://github.com/gohugoio/hugo/issues/3690](https://github.com/gohugoio/hugo/issues/3690)

---

<div class="post-metadata">

**Author:** ![damien207](https://avatars.discourse-cdn.com/v4/letter/d/ecc23a/32.png) [@damien207](https://discourse.gohugo.io/u/damien207)\
**Post date:** [July 12, 2017, 12:51pm UTC](https://discourse.gohugo.io/t/getjson-cache-raises-file-name-too-long/7373/4 "2017-07-12T12:51:22Z")

</div>

Try using “Long Path Tool” program that fixes path too long issues with simplicity.

---

<div class="post-metadata">

**Author:** ![timothy](https://avatars.discourse-cdn.com/v4/letter/t/f14d63/32.png) [@timothy](https://discourse.gohugo.io/u/timothy)\
**Post date:** [August 8, 2017, 6:03am UTC](https://discourse.gohugo.io/t/getjson-cache-raises-file-name-too-long/7373/5 "2017-08-08T06:03:50Z")

</div>

try Long Path Tool,it’s very helping in long file name

---

<div class="post-metadata">

**Author:** ![moorereason](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/moorereason/32/592_2.png) [@moorereason](https://discourse.gohugo.io/u/moorereason)\
**Post date:** [August 8, 2017, 1:57pm UTC](https://discourse.gohugo.io/t/getjson-cache-raises-file-name-too-long/7373/6 "2017-08-08T13:57:01Z")

</div>

This issue should be fixed in the latest Hugo release, v0.26.
