Runtime error: invalid memory address or nil pointer dereference after dashboard API import

I’m getting the following error after I import a dashboard (it seems to be done successfully, its available in my menu on the home page)

t=2018-04-13T12:10:27-0400 lvl=eror msg=“Request error” logger=context userId=1 orgId=1 uname=admin error=“runtime error: invalid memory address or nil pointer dereference” stack="/efs/dist/bti/golang/1.8.3/exec/src/runtime/panic.go:489 (0x43398f)\n\tgopanic: reflectcall(nil, unsafe.Pointer(d.fn), deferArgs(d), uint32(d.siz), uint32(d.siz))\n/efs/dist/bti/golang/1.8.3/exec/src/runtime/panic.go:63 (0x43283e)\n\tpanicmem: panic(memoryError)\n/efs/dist/bti/golang/1.8.3/exec/src/runtime/signal_unix.go:290 (0x448e7f)\n\tsigpanic: panicmem()\n/efs/dev/bti/grafana/4.5.2-build001/build/x86-64.rhel.6/src/github.com/grafana/grafana/pkg/models/dashboards.go:75 (0x804522)\n\tNewDashboardFromJson: dash.Title = dash.Data.Get(“title”).MustString()\n/efs/dev/bti/grafana/4.5.2-build001/build/x86-64.rhel.6/src/github.com/grafana/grafana/pkg/plugins/dashboard_importer.go:53 (0x87b829)\n\tImportDashboard: dashboard = m.NewDashboardFromJson(cmd.Dashboard)\n/efs/dist/bti/golang/1.8.3/exec/src/runtime/asm_amd64.s:514 (0x460818)\n\tcall32: CALLFN(·call32, 32)\n/efs/dist/bti/golang/1.8.3/exec/src/reflect/value.go:434 (0x4b1baf)\n\tValue.call: call(frametype, fn, args, uint32(frametype.size), uint32(retOffset))\n/efs/dist/bti/golang/1.8.3/exec/src/reflect/value.go:302 (0x4b1174)\n\tValue.Call: return v.call(“Call”, in)\n/efs/dev/bti/grafana/4.5.2-build001/build/x86-64.rhel.6/src/github.com/grafana/grafana/pkg/bus/bus.go:73 (0x81426e)\n\t(*InProcBus).Dispatch: ret := reflect.ValueOf(handler).Call(params)\n/efs/dev/bti/grafana/4.5.2-build001/build/x86-64.rhel.6/src/github.com/grafana/grafana/pkg/bus/bus.go:154 (0x815049)\n\tDispatch: return globalBus.Dispatch(msg)\n/efs/dev/bti/grafana/4.5.2-build001/build/x86-64.rhel.6/src/github.com/grafana/grafana/pkg/api/plugins.go:177 (0xe28491)\n\tImportDashboard: if err := bus.Dispatch(&cmd); err != nil {\n/efs/dist/bti/golang/1.8.3/exec/src/runtime/asm_amd64.s:516 (0x460936)\n\tcall128: CALLFN(·call128, 128)\n/efs/dist/bti/golang/1.8.3/exec/src/reflect/value.go:434 (0x4b1baf)\n\tValue.call: call(frametype, fn, args, uint32(frametype.size), uint32(retOffset))\n/efs/dist/bti/golang/1.8.3/exec/src/reflect/value.go:302 (0x4b1174)\n\tValue.Call: return v.call(“Call”, in)\n/efs/dev/bti/grafana/4.5.2-build001/build/x86-64.rhel.6/src/github.com/grafana/grafana/vendor/github.com/go-macaron/inject/inject.go:177 (0x7851cf)\n\t(*injector).callInvoke: return reflect.ValueOf(f).Call(in), nil\n/efs/dev/bti/grafana/4.5.2-build001/build/x86-64.rhel.6/src/github.com/grafana/grafana/vendor/github.com/go-macaron/inject/inject.go:137 (0x784b9a)\n\t(*injector).Invoke: return inj.callInvoke(f, t, t.NumIn())\n/efs/dev/bti/grafana/4.5.2-build001/build/x86-64.rhel.6/src/github.com/grafana/grafana/pkg/api/common.go:37 (0xe3975c)\n\twrap.func1: val, err := c.Invoke(action)\n/efs/dist/bti/golang/1.8.3/exec/src/runtime/asm_amd64.s:514 (0x460818)\n\tcall32: CALLFN(·call32, 32)\n/efs/dist/bti/golang/1.8.3/exec/src/reflect/value.go:434 (0x4b1baf)\n\tValue.call: call(frametype, fn, args, uint32(frametype.size), uint32(retOffset))\n/efs/dist/bti/golang/1.8.3/exec/src/reflect/value.go:302 (0x4b1174)\n\tValue.Call: return v.call(“Call”, in)\n/efs/dev/bti/grafana/4.5.2-build001/build/x86-64.rhel.6/src/github.com/grafana/grafana/vendor/github.com/go-macaron/inject/inject.go:177 (0x7851cf)\n\t(*injector).callInvoke: return reflect.ValueOf(f).Call(in), nil\n/efs/dev/bti/grafana/4.5.2-build001/build/x86-64.rhel.6/src/github.com/grafana/grafana/vendor/github.com/go-macaron/inject/inject.go:137 (0x784b9a)\n\t(*injector).Invoke: return inj.callInvoke(f, t, t.NumIn())\n/efs/dev/bti/grafana/4.5.2-build001/build/x86-64.rhel.6/src/github.com/grafana/grafana/vendor/gopkg.in/macaron.v1/context.go:121 (0x7a2e72)\n\t(*Context).run: vals, err := c.Invoke(c.handler())\n/efs/dev/bti/grafana/4.5.2-build001/build/x86-64.rhel.6/src/github.com/grafana/grafana/vendor/gopkg.in/macaron.v1/context.go:112 (0x7a2d96)\n\t(*Context).Next: c.run()\n/efs/dev/bti/grafana/4.5.2-build001/build/x86-64.rhel.6/src/github.com/grafana/grafana/pkg/middleware/request_metrics.go:17 (0xbb03a3)\n\tRequestMetrics.func1: c.Next()\n/efs/dist/bti/golang/1.8.3/exec/src/runtime/asm_amd64.s:514 (0x460818)\n\tcall32: CALLFN(·call32, 32)\n/efs/dist/bti/golang/1.8.3/exec/src/reflect/value.go:434 (0x4b1baf)\n\tValue.call: call(frametype, fn, args, uint32(frametype.size), uint32(retOffset))\n/efs/dist/bti/golang/1.8.3/exec/src/reflect/value.go:302 (0x4b1174)\n\tValue.Call: return v.call(“Call”, in)\n/efs/dev/bti/grafana/4.5.2-build001/build/x86-64.rhel.6/src/github.com/grafana/grafana/vendor/github.com/go-macaron/inject/inject.go:177 (0x7851cf)\n\t(*injector).callInvoke: return reflect.ValueOf(f).Call(in), nil\n/efs/dev/bti/grafana/4.5.2-build001/build/x86-64.rhel.6/src/github.com/grafana/grafana/vendor/github.com/go-macaron/inject/inject.go:137 (0x784b9a)\n\t(*injector).Invoke: return inj.callInvoke(f, t, t.NumIn())\n/efs/dev/bti/grafana/4.5.2-build001/build/x86-64.rhel.6/src/github.com/grafana/grafana/vendor/gopkg.in/macaron.v1/context.go:121 (0x7a2e72)\n\t(*Context).run: vals, err := c.Invoke(c.handler())\n/efs/dev/bti/grafana/4.5.2-build001/build/x86-64.rhel.6/src/github.com/grafana/grafana/vendor/gopkg.in/macaron.v1/context.go:112 (0x7a2d96)\n\t(*Context).Next: c.run()\n/efs/dev/bti/grafana/4.5.2-build001/build/x86-64.rhel.6/src/github.com/grafana/grafana/pkg/middleware/session.go:79 (0xbb081b)\n\tSessioner.func1: ctx.Next()\n/efs/dist/bti/golang/1.8.3/exec/src/runtime/asm_amd64.s:514 (0x460818)\n\tcall32: CALLFN(·call32, 32)\n/efs/dist/bti/golang/1.8.3/exec/src/reflect/value.go:434 (0x4b1baf)\n\tValue.call: call(frametype, fn, args, uint32(frametype.size), uint32(retOffset))\n/efs/dist/bti/golang/1.8.3/exec/src/reflect/value.go:302 (0x4b1174)\n\tValue.Call: return v.call(“Call”, in)\n/efs/dev/bti/grafana/4.5.2-build001/build/x86-64.rhel.6/src/github.com/grafana/grafana/vendor/github.com/go-macaron/inject/inject.go:177 (0x7851cf)\n\t(*injector).callInvoke: return reflect.ValueOf(f).Call(in), nil\n/efs/dev/bti/grafana/4.5.2-build001/build/x86-64.rhel.6/src/github.com/grafana/grafana/vendor/github.com/go-macaron/inject/inject.go:137 (0x784b9a)\n\t(*injector).Invoke: return inj.callInvoke(f, t, t.NumIn())\n/efs/dev/bti/grafana/4.5.2-build001/build/x86-64.rhel.6/src/github.com/grafana/grafana/vendor/gopkg.in/macaron.v1/context.go:121 (0x7a2e72)\n\t(*Context).run: vals, err := c.Invoke(c.handler())\n/efs/dev/bti/grafana/4.5.2-build001/build/x86-64.rhel.6/src/github.com/grafana/grafana/vendor/gopkg.in/macaron.v1/context.go:112 (0x7a2d96)\n\t(*Context).Next: c.run()\n/efs/dev/bti/grafana/4.5.2-build001/build/x86-64.rhel.6/src/github.com/grafana/grafana/pkg/middleware/recovery.go:146 (0xbb02c1)\n\tRecovery.func1: c.Next()\n/efs/dev/bti/grafana/4.5.2-build001/build/x86-64.rhel.6/src/github.com/grafana/grafana/vendor/gopkg.in/macaron.v1/context.go:79 (0x7a2c11)\n\tContextInvoker.Invoke: invoke(params[0].(*Context))\n/efs/dev/bti/grafana/4.5.2-build001/build/x86-64.rhel.6/src/github.com/grafana/grafana/vendor/github.com/go-macaron/inject/inject.go:157 (0x784ea2)\n\t(*injector).fastInvoke: return f.Invoke(in)\n/efs/dev/bti/grafana/4.5.2-build001/build/x86-64.rhel.6/src/github.com/grafana/grafana/vendor/github.com/go-macaron/inject/inject.go:135 (0x784c9b)\n\t(*injector).Invoke: return inj.fastInvoke(v, t, t.NumIn())\n/efs/dev/bti/grafana/4.5.2-build001/build/x86-64.rhel.6/src/github.com/grafana/grafana/vendor/gopkg.in/macaron.v1/context.go:121 (0x7a2e72)\n\t(*Context).run: vals, err := c.Invoke(c.handler())\n/efs/dev/bti/grafana/4.5.2-build001/build/x86-64.rhel.6/src/github.com/grafana/grafana/vendor/gopkg.in/macaron.v1/context.go:112 (0x7a2d96)\n\t(*Context).Next: c.run()\n/efs/dev/bti/grafana/4.5.2-build001/build/x86-64.rhel.6/src/github.com/grafana/grafana/pkg/middleware/logger.go:33 (0xbad892)\n\tLogger.func1: c.Next()\n/efs/dist/bti/golang/1.8.3/exec/src/runtime/asm_amd64.s:514 (0x460818)\n\tcall32: CALLFN(·call32, 32)\n/efs/dist/bti/golang/1.8.3/exec/src/reflect/value.go:434 (0x4b1baf)\n\tValue.call: call(frametype, fn, args, uint32(frametype.size), uint32(retOffset))\n/efs/dist/bti/golang/1.8.3/exec/src/reflect/value.go:302 (0x4b1174)\n\tValue.Call: return v.call(“Call”, in)\n/efs/dev/bti/grafana/4.5.2-build001/build/x86-64.rhel.6/src/github.com/grafana/grafana/vendor/github.com/go-macaron/inject/inject.go:177 (0x7851cf)\n\t(*injector).callInvoke: return reflect.ValueOf(f).Call(in), nil\n/efs/dev/bti/grafana/4.5.2-build001/build/x86-64.rhel.6/src/github.com/grafana/grafana/vendor/github.com/go-macaron/inject/inject.go:137 (0x784b9a)\n\t(*injector).Invoke: return inj.callInvoke(f, t, t.NumIn())\n/efs/dev/bti/grafana/4.5.2-build001/build/x86-64.rhel.6/src/github.com/grafana/grafana/vendor/gopkg.in/macaron.v1/context.go:121 (0x7a2e72)\n\t(*Context).run: vals, err := c.Invoke(c.handler())\n/efs/dev/bti/grafana/4.5.2-build001/build/x86-64.rhel.6/src/github.com/grafana/grafana/vendor/gopkg.in/macaron.v1/router.go:187 (0x7b4cc9)\n\t(*Router).Handle.func1: c.run()\n/efs/dev/bti/grafana/4.5.2-build001/build/x86-64.rhel.6/src/github.com/grafana/grafana/vendor/gopkg.in/macaron.v1/router.go:296 (0x7af0cd)\n\t(*Router).ServeHTTP: h(rw, req, p)\n/efs/dev/bti/grafana/4.5.2-build001/build/x86-64.rhel.6/src/github.com/grafana/grafana/vendor/gopkg.in/macaron.v1/macaron.go:220 (0x7a794c)\n\t(*Macaron).ServeHTTP: m.Router.ServeHTTP(rw, req)\n/efs/dist/bti/golang/1.8.3/exec/src/net/http/server.go:2568 (0x691922)\n\tserverHandler.ServeHTTP: handler.ServeHTTP(rw, req)\n/efs/dist/bti/golang/1.8.3/exec/src/net/http/server.go:1825 (0x68dc92)\n\t(*conn).serve: serverHandler{c.server}.ServeHTTP(w, w.req)\n/efs/dist/bti/golang/1.8.3/exec/src/runtime/asm_amd64.s:2197 (0x462fb1)\n\tgoexit: BYTE\t$0x90\t// NOP\n"
t=2018-04-13T12:10:27-0400 lvl=eror msg=“Request Completed” logger=context userId=1 orgId=1 uname=admin method=POST path=/api/dashboards/import status=500 remote_addr=127.0.0.1 time_ms=180 size=713 referer=

I’ve narrowed it down to importing a dashboard with a template datasource w/ influxdb. For some reason 2 of the 3 variables import, but one doesn’t causing the whole dashboard to fail…