"Error in Go routine: runtime error: invalid memory address or nil pointer dereference" on docker-compose up -d

There are times we feel how much ever we do, there is scope to do much more in this world! This is applicable to everything and technical aspects are no different! For instance, I was confronted with this traefik error. 

Screen shots for reference:

docker logs -f  <traefik container id>

Result from docker list :


Traefik unhealthy after sometime:


This error started happening when I dockered down an old instance and docker up a new Sitecore instance with completely new name. By the way, I ensured that the env variables and the certificates reflected the new instance name.

I tried all the routine stuff like, clear the xp0 sub-folders, prune, restart docker, restart computer without any fruitful result.

I couldn't find any results over the web too for this particular error. So, I was on my own this time too!

Given my craze for automation, it stroked me that I actually had auto-generated the config files as well as the certificates under the traefik folder and the issue could be with the auto-generation. So, I compared the auto-generated config yaml with the default xp0 ones and the only issue I could find was, the lack of tabbing / spacing in case of the certs_config yaml file I had auto-generated:


It should actually look like this:


When I fixed this and dockered up my instance, the traefik container was healthy and I could reach the new CM Server:




I decided to blog the same to convey how important the tabbing/spacing is in case of the certs_config yaml sitting under the dynamic folder:


Error:

time="2021-09-25T02:36:46Z" level=info msg="Configuration loaded from flags."

time="2021-09-25T02:36:46Z" level=error msg="Error in Go routine: runtime error: invalid memory address or nil pointer dereference"

time="2021-09-25T02:36:46Z" level=error msg="Stack: goroutine 39 [running]:\nruntime/debug.Stack(0xc000110000, 0x2806dd5, 0x17)\n\t/usr/local/go/src/runtime/debug/stack.go:24 +0xa4\ngithub.com/containous/traefik/v2/pkg/safe.defaultRecoverGoroutine(0x2386e00, 0x454b900)\n\t/go/src/github.com/containous/traefik/pkg/safe/routine.go:66 +0xb8\ngithub.com/containous/traefik/v2/pkg/safe.GoWithRecover.func1.1(0x28f8860)\n\t/go/src/github.com/containous/traefik/pkg/safe/routine.go:56 +0x5e\npanic(0x2386e00, 0x454b900)\n\t/usr/local/go/src/runtime/panic.go:967 +0x174\ngithub.com/containous/traefik/v2/pkg/provider/file.(*Provider).loadFileConfigFromDirectory(0xc0003d1f80, 0x2cc1320, 0xc00031f1a0, 0xc0000b815b, 0x1d, 0xc0002e1800, 0xc00031f1a0, 0xc000345d50, 0x478473)\n\t/go/src/github.com/containous/traefik/pkg/provider/file/file.go:311 +0x13ca\ngithub.com/containous/traefik/v2/pkg/provider/file.(*Provider).BuildConfiguration(0xc0003d1f80, 0x457d840, 0x1607b0, 0x0)\n\t/go/src/github.com/containous/traefik/pkg/provider/file/file.go:84 +0x198\ngithub.com/containous/traefik/v2/pkg/provider/file.(*Provider).Provide(0xc0003d1f80, 0xc00042e000, 0xc00031ec60, 0xc0002e1700, 0x2)\n\t/go/src/github.com/containous/traefik/pkg/provider/file/file.go:51 +0x39\ngithub.com/containous/traefik/v2/pkg/provider/aggregator.launchProvider(0xc00042e000, 0xc00031ec60, 0x2c7cae0, 0xc0003d1f80)\n\t/go/src/github.com/containous/traefik/pkg/provider/aggregator/aggregator.go:126 +0x2b3\ngithub.com/containous/traefik/v2/pkg/provider/aggregator.ProviderAggregator.Provide(0xc0003d1f80, 0xc0002e0b00, 0x2, 0x2, 0xc00042e000, 0xc00031ec60, 0x0, 0x0)\n\t/go/src/github.com/containous/traefik/pkg/provider/aggregator/aggregator.go:105 +0x181\ngithub.com/containous/traefik/v2/pkg/server.(*ConfigurationWatcher).startProvider.func1()\n\t/go/src/github.com/containous/traefik/pkg/server/configurationwatcher.go:92 +0x6f\ngithub.com/containous/traefik/v2/pkg/safe.GoWithRecover.func1(0x28f8860, 0xc00031f0b0)\n\t/go/src/github.com/containous/traefik/pkg/safe/routine.go:59 +0x56\ncreated by github.com/containous/traefik/v2/pkg/safe.GoWithRecover\n\t/go/src/github.com/containous/traefik/pkg/safe/routine.go:53 +0x50\n"



Comments