# Port already in use

**URL:** <https://discourse.gohugo.io/t/port-already-in-use/21315>\
**Category:** support\
**Created:** [October 18, 2019, 9:45am UTC](https://discourse.gohugo.io/t/port-already-in-use/21315 "2019-10-18T09:45:40Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![prabhakar\_shanmugam](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/prabhakar_shanmugam/32/6674_2.png) [@prabhakar\_shanmugam](https://discourse.gohugo.io/u/prabhakar_shanmugam)\
**Post date:** [October 18, 2019, 9:45am UTC](https://discourse.gohugo.io/t/port-already-in-use/21315/1 "2019-10-18T09:45:40Z")

</div>

Hi I have a new installation of Hugo using snap install and when I try to do Hugo server, it gives me an error saying  
port 1313 already in use, attempting to use an available port  
panic: runtime error: invalid memory address or nil pointer dereference  
[signal SIGSEGV: segmentation violation code=0x1 addr=0x18 pc=0x12f0db7]

While I tried looking into similar posts in the same forum, those solutions did not help.

The difficulty here is that it does not go and take a new available port … instead, it gives this huge error.

goroutine 1 [running]:  
[github.com/gohugoio/hugo/commands.(\*serverCmd](http://github.com/gohugoio/hugo/commands.(*serverCmd)).server.func1.1()  
/build/hugo/parts/hugo/build/commands/server.go:193 +0x437  
sync.(\*Once).doSlow(0xc0004df1f0, 0xc0006c7758)  
/snap/go/4409/src/sync/once.go:66 +0xe3  
sync.(\*Once).Do(…)  
/snap/go/4409/src/sync/once.go:57  
[github.com/gohugoio/hugo/commands.(\*serverCmd](http://github.com/gohugoio/hugo/commands.(*serverCmd)).server.func1(0xc0000be410, 0x16a18e6, 0x13)  
/build/hugo/parts/hugo/build/commands/server.go:166 +0x8b4  
[github.com/gohugoio/hugo/commands.(\*commandeer](http://github.com/gohugoio/hugo/commands.(*commandeer)).loadConfig(0xc0000be410, 0xc0000b0101, 0x1998700, 0xc00037d060)  
/build/hugo/parts/hugo/build/commands/commandeer.go:333 +0x915  
[github.com/gohugoio/hugo/commands.newCommandeer](http://github.com/gohugoio/hugo/commands.newCommandeer)(0x101, 0xc000315e10, 0x1996560, 0xc000052680, 0xc0004697a0, 0x0, 0x0, 0x0, 0x1545220, 0xc000570900, …)  
/build/hugo/parts/hugo/build/commands/commandeer.go:178 +0x20f  
[github.com/gohugoio/hugo/commands.initializeConfig](http://github.com/gohugoio/hugo/commands.initializeConfig)(0x101, 0xc000315e10, 0x1996560, 0xc000052680, 0xc0004697a0, 0x0, 0x0, 0xc0000c5408)  
/build/hugo/parts/hugo/build/commands/hugo.go:123 +0x76  
[github.com/gohugoio/hugo/commands.(\*serverCmd](http://github.com/gohugoio/hugo/commands.(*serverCmd)).server(0xc000052680, 0xc000116780, 0xc000510d70, 0x0, 0x5, 0x0, 0x0)  
/build/hugo/parts/hugo/build/commands/server.go:238 +0x1c5  
[github.com/spf13/cobra.(\*Command](http://github.com/spf13/cobra.(*Command)).execute(0xc000116780, 0xc000510d20, 0x5, 0x5, 0xc000116780, 0xc000510d20)  
/build/hugo/parts/hugo/go/pkg/mod/github.com/spf13/cobra@v0.0.4-0.20190321000552-67fc4837d267/command.go:762 +0x460  
[github.com/spf13/cobra.(\*Command](http://github.com/spf13/cobra.(*Command)).ExecuteC(0xc000563180, 0xc00037c670, 0xc0006c7ec0, 0x12cc2e2)  
/build/hugo/parts/hugo/go/pkg/mod/github.com/spf13/cobra@v0.0.4-0.20190321000552-67fc4837d267/command.go:850 +0x2fb  
[github.com/gohugoio/hugo/commands.Execute](http://github.com/gohugoio/hugo/commands.Execute)(0xc000032080, 0x6, 0x6, 0x4074ff, 0xc0000400b8, 0x0, 0x0)  
/build/hugo/parts/hugo/build/commands/hugo.go:89 +0xb9  
main.main()  
/build/hugo/parts/hugo/build/main.go:23 +0x6c

Can you help?

It used to work nicely when I had Hugo 55. Now that I have updated to Hugo 58, I am getting this error.

---

<div class="post-metadata">

**Author:** ![ju52](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/ju52/32/6749_2.png) [@ju52](https://discourse.gohugo.io/u/ju52)\
**Post date:** [October 18, 2019, 11:55am UTC](https://discourse.gohugo.io/t/port-already-in-use/21315/2 "2019-10-18T11:55:15Z")

</div>

hi,

this happens if you start **hugo server** twice.

---

<div class="post-metadata">

**Author:** ![\_nm](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/_nm/32/7662_2.png) [@\_nm](https://discourse.gohugo.io/u/_nm)\
**Post date:** [October 18, 2019, 5:17pm UTC](https://discourse.gohugo.io/t/port-already-in-use/21315/3 "2019-10-18T17:17:22Z")

</div>

> [@ju52](#):
>
> this happens if you start **hugo server** twice.

I can’t help with @prabhakar_shanmugam’s question, but want to let you all know that I have no problem running `hugo server` twice on Windows using hugo v0.58.3. I just tested it and here’s an excerpt from the second instance of `hugo server`:

```auto
port 1313 already in use, attempting to use an available port
Building sites …
 : 
 :  
Web Server is available at //localhost:63987/ (bind address 127.0.0.1)
Press Ctrl+C to stop

```

Good luck debugging this!

---

<div class="post-metadata">

**Author:** ![prabhakar\_shanmugam](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/prabhakar_shanmugam/32/6674_2.png) [@prabhakar\_shanmugam](https://discourse.gohugo.io/u/prabhakar_shanmugam)\
**Post date:** [October 19, 2019, 4:19am UTC](https://discourse.gohugo.io/t/port-already-in-use/21315/4 "2019-10-19T04:19:59Z")

</div>

Hi

Thanks for the reply.

I restarted the system to be sure if thats not the case.

In a fresh restart and a fresh terminal i tried and I still get the same.

How to ascertain this and how to delete / kill the other hugo instance.

On a second thought, could it be because I installed Hugo using snapcraft.

Thanks again

---

<div class="post-metadata">

**Author:** ![prabhakar\_shanmugam](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/prabhakar_shanmugam/32/6674_2.png) [@prabhakar\_shanmugam](https://discourse.gohugo.io/u/prabhakar_shanmugam)\
**Post date:** [October 19, 2019, 4:31am UTC](https://discourse.gohugo.io/t/port-already-in-use/21315/5 "2019-10-19T04:31:45Z")

</div>

Hi

I uninstalled hugo that i installed through snap  
I reinstalled using the deb file download from github  
It workssss!!!

I thank you again for your time.

May be its the snap install that made it corrupt. I am not sure.
