# \`hugo mod get\` always slow

**URL:** <https://discourse.gohugo.io/t/hugo-mod-get-always-slow/39419>\
**Category:** support\
**Tags:** modules\
**Created:** [July 8, 2022, 4:17pm UTC](https://discourse.gohugo.io/t/hugo-mod-get-always-slow/39419 "2022-07-08T16:17:52Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![razon](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/razon/32/14882_2.png) [@razon](https://discourse.gohugo.io/u/razon)\
**Post date:** [July 8, 2022, 4:17pm UTC](https://discourse.gohugo.io/t/hugo-mod-get-always-slow/39419/1 "2022-07-08T16:17:52Z")

</div>

Hi, I use Hugo module to install theme, but every time I execute `hugo mod get`, it’s always slow. How can I diagnose it?

Thanks.

---

<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 8, 2022, 4:44pm UTC](https://discourse.gohugo.io/t/hugo-mod-get-always-slow/39419/2 "2022-07-08T16:44:41Z")

</div>

> [@razon](#):
>
> How can I diagnose it?

I would guess that slow means that it does not use the cache for some reason.

What I would recommend you do as a start is to set the `HUGO_CACHEDIR` env var to some directory that you know exist and is writable. If you then run Hugo you should see files pulled into `HUGO_CACHEDIR/modules`.

---

<div class="post-metadata">

**Author:** ![razon](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/razon/32/14882_2.png) [@razon](https://discourse.gohugo.io/u/razon)\
**Post date:** [July 9, 2022, 8:58am UTC](https://discourse.gohugo.io/t/hugo-mod-get-always-slow/39419/3 "2022-07-09T08:58:18Z")

</div>

Thank you. I found that upgrade module via `hugo mod get` always fail, but it’s weird that `go get` works fine.

```nohighlight
$ HUGO_CACHEDIR=$PWD/vendor hugo mod get github.com/razonyang/hugo-theme-bootstrap@master
hugo: downloading modules …
go: github.com/razonyang/hugo-theme-bootstrap@v1.0.0-alpha.1.0.20220708160018-560a68166b0a: invalid version: git ls-remote -q origin in /home/razonyang/Projects/razonyang/hugo-theme-bootstrap-site/vendor/modules/filecache/modules/pkg/mod/cache/vcs/348a35abd6584f23aeb4a9124871cf51b665ede955a2f430e06713f21b056184: exit status 128:
        fatal: unable to access 'https://github.com/razonyang/hugo-theme-bootstrap/': Error in the HTTP2 framing layer
hugo: collected modules in 138063 ms
WARN 2022/07/09 16:15:41 failed to download modules: failed to execute 'go [mod download]': failed to execute binary "go" with args [mod download]: go: github.com/razonyang/hugo-theme-bootstrap@v1.0.0-alpha.1.0.20220708160018-560a68166b0a: invalid version: git ls-remote -q origin in /home/razonyang/Projects/razonyang/hugo-theme-bootstrap-site/vendor/modules/filecache/modules/pkg/mod/cache/vcs/348a35abd6584f23aeb4a9124871cf51b665ede955a2f430e06713f21b056184: exit status 128:
        fatal: unable to access 'https://github.com/razonyang/hugo-theme-bootstrap/': Error in the HTTP2 framing layer
 *errors.errorString

$ GOPROXY=https://goproxy.cn HUGO_CACHEDIR=$PWD/vendor hugo mod get github.com/razonyang/hugo-theme-bootstrap@master
hugo: downloading modules …
go: github.com/razonyang/hugo-theme-bootstrap@v1.0.0-alpha.1.0.20220708160018-560a68166b0a: invalid version: git fetch -f origin refs/heads/*:refs/heads/* refs/tags/*:refs/tags/* in /home/razonyang/Projects/razonyang/hugo-theme-bootstrap-site/vendor/modules/filecache/modules/pkg/mod/cache/vcs/348a35abd6584f23aeb4a9124871cf51b665ede955a2f430e06713f21b056184: exit status 128:
        fatal: the remote end hung up unexpectedly
        fatal: early EOF
        fatal: index-pack failed
hugo: collected modules in 1140149 ms
WARN 2022/07/09 16:43:05 failed to download modules: failed to execute 'go [mod download]': failed to execute binary "go" with args [mod download]: go: github.com/razonyang/hugo-theme-bootstrap@v1.0.0-alpha.1.0.20220708160018-560a68166b0a: invalid version: git fetch -f origin refs/heads/*:refs/heads/* refs/tags/*:refs/tags/* in /home/razonyang/Projects/razonyang/hugo-theme-bootstrap-site/vendor/modules/filecache/modules/pkg/mod/cache/vcs/348a35abd6584f23aeb4a9124871cf51b665ede955a2f430e06713f21b056184: exit status 128:
        fatal: the remote end hung up unexpectedly
        fatal: early EOF
        fatal: index-pack failed
 *errors.errorString
go: github.com/razonyang/hugo-theme-bootstrap@v1.0.0-alpha.1.0.20220708160018-560a68166b0a: invalid version: git fetch -f origin refs/heads/*:refs/heads/* refs/tags/*:refs/tags/* in /home/razonyang/Projects/razonyang/hugo-theme-bootstrap-site/vendor/modules/filecache/modules/pkg/mod/cache/vcs/348a35abd6584f23aeb4a9124871cf51b665ede955a2f430e06713f21b056184: exit status 128:
        fatal: unable to access 'https://github.com/razonyang/hugo-theme-bootstrap/': GnuTLS recv error (-110): The TLS connection was non-properly terminated.
Error: failed to get ["-d" "github.com/razonyang/hugo-theme-bootstrap@master"]: failed to execute 'go [get -d github.com/razonyang/hugo-theme-bootstrap@master]': failed to execute binary "go" with args [get -d github.com/razonyang/hugo-theme-bootstrap@master]: go: github.com/razonyang/hugo-theme-bootstrap@v1.0.0-alpha.1.0.20220708160018-560a68166b0a: invalid version: git fetch -f origin refs/heads/*:refs/heads/* refs/tags/*:refs/tags/* in /home/razonyang/Projects/razonyang/hugo-theme-bootstrap-site/vendor/modules/filecache/modules/pkg/mod/cache/vcs/348a35abd6584f23aeb4a9124871cf51b665ede955a2f430e06713f21b056184: exit status 128:
        fatal: unable to access 'https://github.com/razonyang/hugo-theme-bootstrap/': GnuTLS recv error (-110): The TLS connection was non-properly terminated.
 *errors.errorString

$ GOPROXY=https://goproxy.cn go get -d github.com/razonyang/hugo-theme-bootstrap@master 
go: downloading github.com/razonyang/hugo-theme-bootstrap v1.0.0-alpha.1.0.20220709075819-a5c93d6e6a09
go: upgraded github.com/razonyang/hugo-theme-bootstrap v1.0.0-alpha.1.0.20220708160018-560a68166b0a => v1.0.0-alpha.1.0.20220709075819-a5c93d6e6a09

```

The previous commands hang for more than 5 minutes and fail, but `go get` executed within 10 seconds.

---

<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, 2022, 9:35am UTC](https://discourse.gohugo.io/t/hugo-mod-get-always-slow/39419/4 "2022-07-09T09:35:40Z")

</div>

> [@razon](#):
>
> The previous commands hang for more than 5 minutes and fail, but `go get` executed within 10 seconds.

It’s hard to debug this looking at logs only, but I can give you one tip:

Hugo does not respect the `GOPROXY` env var (for good reasons). If you want to use a Go proxy server, set the module.proxy config (or via `HUGO_MODULE_PROXY`).

---

<div class="post-metadata">

**Author:** ![razon](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/razon/32/14882_2.png) [@razon](https://discourse.gohugo.io/u/razon)\
**Post date:** [July 9, 2022, 9:52am UTC](https://discourse.gohugo.io/t/hugo-mod-get-always-slow/39419/5 "2022-07-09T09:52:41Z")

</div>

Thanks a lot 👍 . Replace `GOPROXY` with `HUGO_MODULE_PROXY` works as expected.

---

<div class="post-metadata">

**Author:** ![system](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/system/32/1_2.png) [@system](https://discourse.gohugo.io/u/system)\
**Post date:** [July 11, 2022, 9:53am UTC](https://discourse.gohugo.io/t/hugo-mod-get-always-slow/39419/6 "2022-07-11T09:53:40Z")

</div>

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