Could not save this module: Request failed with status code 500

Hi There,

I tried to add 2 Fields to a long existing module and got the Error:
Could not save this module: Request failed with status code 500

I tried to reload the page (cache deleted) and just saved the module without any modification and got the same error. so it must be something inside the module which is already saved.
I tried to save another module without changes and got no problem with that.
I also restarted corteza stack in case of any memory problem.

i have got the following error on corteza server side:

DEBUG   crashed on http request {"error": "runtime error: invalid memory address or nil pointer dereference", "stack": "goroutine 4982 [running]:\nruntime/debug.Stack(0xc000090540, 0xc00007f200, 0x1)\n\t/opt/hostedtoolcache/go/1.16.9/x64/src/runtime/debug/stack.go:24 +0x9f\ngithub.com/cortezaproject/corteza-server/pkg/api/server.handlePanic.func1.1(0x230ae00, 0xc000fd4fc0)\n\t/home/runner/work/corteza-server/corteza-server/pkg/api/server/middleware.go:46 +0x234\npanic(0x1b40720, 0x2e965e0)\n\t/opt/hostedtoolcache/go/1.16.9/x64/src/runtime/panic.go:965 +0x1b9\ngithub.com/cortezaproject/corteza-server/compose/service.defaultValidator.func2(0x2313418, 0xc000892570, 0x2356b88, 0xc000925230, 0xc0011baf60, 0xc000931d40, 0xc000a327e0, 0x7f4f0b6e6f18, 0xc000116000, 0xc00099bb00)\n\t/home/runner/work/corteza-server/corteza-server/compose/service/record.go:184 +0x3f\ngithub.com/cortezaproject/corteza-server/compose/service/values.validator.vRecord(0x212f048, 0xc000a19f50, 0x212f050, 0x212f058, 0x212f0b0, 0x2313418, 0xc000892570, 0x2356b88, 0xc000925230, 0xc0011baf60, ...)\n\t/home/runner/work/corteza-server/corteza-server/compose/service/values/validator.go:338 +0xa8\ngithub.com/cortezaproject/corteza-server/compose/service/values.validator.Run(0x212f048, 0xc000a19f50, 0x212f050, 0x212f058, 0x212f0b0, 0x2313418, 0xc000892570, 0x2356b88, 0xc000925230, 0xc000a327e0, ...)\n\t/home/runner/work/corteza-server/corteza-server/compose/service/values/validator.go:173 +0x290f\ngithub.com/cortezaproject/corteza-server/compose/service.moduleFieldDefaultPreparer(0x2313418, 0xc000892570, 0x2356b88, 0xc000925230, 0xc001151440, 0xc001194600, 0x5e, 0x5e, 0x0, 0x0, ...)\n\t/home/runner/work/corteza-server/corteza-server/compose/service/module.go:701 +0x2f7\ngithub.com/cortezaproject/corteza-server/compose/service.updateModuleFields(0x2313418, 0xc000892570, 0x2356b88, 0xc000925230, 0xc001151440, 0xc0011514d0, 0x1, 0x0, 0x0)\n\t/home/runner/work/corteza-server/corteza-server/compose/service/module.go:605 +0x4a9\ngithub.com/cortezaproject/corteza-server/compose/service.module.updater.func1(0x2313418, 0xc000892570, 0x2356b88, 0xc000925230, 0x0, 0xc000bc4200)\n\t/home/runner/work/corteza-server/corteza-server/compose/service/module.go:362 +0xbff\ngithub.com/cortezaproject/corteza-server/store/rdbms.Store.Tx.func1(0x2313418, 0xc000892570, 0x2317918, 0xc000925200, 0xc000925200, 0x0)\n\t/home/runner/work/corteza-server/corteza-server/store/rdbms/rdbms.go:258 +0xc8\ngithub.com/cortezaproject/corteza-server/store/rdbms.tx(0x2313418, 0xc000892570, 0x1d761c0, 0xc000839200, 0xc000824d20, 0x0, 0xc0011ce518, 0xc000925170, 0xc000966598)\n\t/home/runner/work/corteza-server/corteza-server/store/rdbms/rdbms.go:380 +0x231\ngithub.com/cortezaproject/corteza-server/store/rdbms.Store.Tx(0xc000824d20, 0x0, 0x0, 0x2317898, 0xc000839200, 0x0, 0x2313418, 0xc000892570, 0xc0003f9180, 0xc000501400, ...)\n\t/home/runner/work/corteza-server/corteza-server/store/rdbms/rdbms.go:257 +0xb3\ngithub.com/cortezaproject/corteza-server/store.Tx(...)\n\t/home/runner/work/corteza-server/corteza-server/store/tx.go:6\ngithub.com/cortezaproject/corteza-server/compose/service.module.updater(0x22fed60, 0xc0003a3680, 0x231fcb8, 0xc000ff2720, 0x22ff3a0, 0xc0002ee810, 0x2355608, 0xc000735078, 0x2316fd8, 0xc00026bd00, ...)\n\t/home/runner/work/corteza-server/corteza-server/compose/service/module.go:315 +0x1f4\ngithub.com/cortezaproject/corteza-server/compose/service.module.Update(0x22fed60, 0xc0003a3680, 0x231fcb8, 0xc000ff2720, 0x22ff3a0, 0xc0002ee810, 0x2355608, 0xc000735078, 0x2316fd8, 0xc00026bd00, ...)\n\t/home/runner/work/corteza-server/corteza-server/compose/service/module.go:294 +0xed\ngithub.com/cortezaproject/corteza-server/compose/rest.(*Module).Update(0xc000683b40, 0x2313418, 0xc000892570, 0xc000228bd0, 0x0, 0x2317898, 0xc000839200, 0x0)\n\t/home/runner/work/corteza-server/corteza-server/compose/rest/module.go:137 +0x14c\ngithub.com/cortezaproject/corteza-server/compose/rest/handlers.NewModule.func4(0x230ae00, 0xc000fd4fc0, 0xc000a49800)\n\t/home/runner/work/corteza-server/corteza-server/compose/rest/handlers/module.go:103 +0x191\nnet/http.HandlerFunc.ServeHTTP(0xc0004993b0, 0x230ae00, 0xc000fd4fc0, 0xc000a49800)\n\t/opt/hostedtoolcache/go/1.16.9/x64/src/net/http/server.go:2049 +0x44\ngithub.com/cortezaproject/corteza-server/pkg/auth.AccessTokenCheck.func1.1(0x230ae00, 0xc000fd4fc0, 0xc000a49800)\n\t/home/runner/work/corteza-server/corteza-server/pkg/auth/middleware.go:41 +0x25e\nnet/http.HandlerFunc.ServeHTTP(0xc0005b3d10, 0x230ae00, 0xc000fd4fc0, 0xc000a49800)\n\t/opt/hostedtoolcache/go/1.16.9/x64/src/net/http/server.go:2049 +0x44\ngithub.com/go-chi/chi.(*ChainHandler).ServeHTTP(0xc0006cf1c0, 0x230ae00, 0xc000fd4fc0, 0xc000a49800)\n\t/home/runner/go/pkg/mod/github.com/go-chi/chi@v3.3.4+incompatible/chain.go:31 +0x52\ngithub.com/go-chi/chi.(*Mux).routeHTTP(0xc0009c4060, 0x230ae00, 0xc000fd4fc0, 0xc000a49800)\n\t/home/runner/go/pkg/mod/github.com/go-chi/chi@v3.3.4+incompatible/mux.go:424 +0x28b\nnet/http.HandlerFunc.ServeHTTP(0xc000515d70, 0x230ae00, 0xc000fd4fc0, 0xc000a49800)\n\t/opt/hostedtoolcache/go/1.16.9/x64/src/net/http/server.go:2049 +0x44\ngithub.com/go-chi/chi.(*Mux).ServeHTTP(0xc0009c4060, 0x230ae00, 0xc000fd4fc0, 0xc000a49800)\n\t/home/runner/go/pkg/mod/github.com/go-chi/chi@v3.3.4+incompatible/mux.go:69 +0x50c\ngithub.com/go-chi/chi.(*Mux).Mount.func1(0x230ae00, 0xc000fd4fc0, 0xc000a49800)\n\t/home/runner/go/pkg/mod/github.com/go-chi/chi@v3.3.4+incompatible/mux.go:291 +0x122\nnet/http.HandlerFunc.ServeHTTP(0xc0006d41e0, 0x230ae00, 0xc000fd4fc0, 0xc000a49800)\n\t/opt/hostedtoolcache/go/1.16.9/x64/src/net/http/server.go:2049 +0x44\ngithub.com/go-chi/chi.(*Mux).routeHTTP(0xc00051d140, 0x230ae00, 0xc000fd4fc0, 0xc000a49800)\n\t/home/runner/go/pkg/mod/github.com/go-chi/chi@v3.3.4+incompatible/mux.go:424 +0x28b\nnet/http.HandlerFunc.ServeHTTP(0xc000515490, 0x230ae00, 0xc000fd4fc0, 0xc000a49800)\n\t/opt/hostedtoolcache/go/1.16.9/x64/src/net/http/server.go:2049 +0x44\ngithub.com/go-chi/chi.(*Mux).ServeHTTP(0xc00051d140, 0x230ae00, 0xc000fd4fc0, 0xc000a49800)\n\t/home/runner/go/pkg/mod/github.com/go-chi/chi@v3.3.4+incompatible/mux.go:69 +0x50c\ngithub.com/go-chi/chi.(*Mux).Mount.func1(0x230ae00, 0xc000fd4fc0, 0xc000a49800)\n\t/home/runner/go/pkg/mod/github.com/go-chi/chi@v3.3.4+incompatible/mux.go:291 +0x122\nnet/http.HandlerFunc.ServeHTTP(0xc0006d4240, 0x230ae00, 0xc000fd4fc0, 0xc000a49800)\n\t/opt/hostedtoolcache/go/1.16.9/x64/src/net/http/server.go:2049 +0x44\ngithub.com/go-chi/chi.(*Mux).routeHTTP(0xc00051cc60, 0x230ae00, 0xc000fd4fc0, 0xc000a49800)\n\t/home/runner/go/pkg/mod/github.com/go-chi/chi@v3.3.4+incompatible/mux.go:424 +0x28b\nnet/http.HandlerFunc.ServeHTTP(0xc000328600, 0x230ae00, 0xc000fd4fc0, 0xc000a49800)\n\t/opt/hostedtoolcache/go/1.16.9/x64/src/net/http/server.go:2049 +0x44\ngithub.com/cortezaproject/corteza-server/pkg/auth.(*token).HttpAuthenticator.func1.1(0x230ae00, 0xc000fd4fc0, 0xc000a49700)\n\t/home/runner/work/corteza-server/corteza-server/pkg/auth/jwt.go:155 +0x309\nnet/http.HandlerFunc.ServeHTTP(0xc000532df8, 0x230ae00, 0xc000fd4fc0, 0xc000a49700)\n\t/opt/hostedtoolcache/go/1.16.9/x64/src/net/http/server.go:2049 +0x44\ngithub.com/go-chi/jwtauth.Verify.func1.1(0x230ae00, 0xc000fd4fc0, 0xc000a49600)\n\t/home/runner/go/pkg/mod/github.com/go-chi/jwtauth@v0.0.0-20190109153619-47840abb19b3/jwtauth.go:82 +0x1c7\nnet/http.HandlerFunc.ServeHTTP(0xc00051e140, 0x230ae00, 0xc000fd4fc0, 0xc000a49600)\n\t/opt/hostedtoolcache/go/1.16.9/x64/src/net/http/server.go:2049 +0x44\ngithub.com/cortezaproject/corteza-server/pkg/api/server.contextLogger.func1.1(0x230ae00, 0xc000fd4fc0, 0xc000a49500)\n\t/home/runner/work/corteza-server/corteza-server/pkg/api/server/logger.go:28 +0x3e9\nnet/http.HandlerFunc.ServeHTTP(0xc0001b1440, 0x230ae00, 0xc000fd4fc0, 0xc000a49500)\n\t/opt/hostedtoolcache/go/1.16.9/x64/src/net/http/server.go:2049 +0x44\ngithub.com/cortezaproject/corteza-server/pkg/api.DebugToContext.func1.1(0x230ae00, 0xc000fd4fc0, 0xc000a49400)\n\t/home/runner/work/corteza-server/corteza-server/pkg/api/debug.go:15 +0x187\nnet/http.HandlerFunc.ServeHTTP(0xc0001b1460, 0x230ae00, 0xc000fd4fc0, 0xc000a49400)\n\t/opt/hostedtoolcache/go/1.16.9/x64/src/net/http/server.go:2049 +0x44\ngithub.com/go-chi/chi/middleware.RequestID.func1(0x230ae00, 0xc000fd4fc0, 0xc000a49300)\n\t/home/runner/go/pkg/mod/github.com/go-chi/chi@v3.3.4+incompatible/middleware/request_id.go:72 +0x1e9\nnet/http.HandlerFunc.ServeHTTP(0xc000532e28, 0x230ae00, 0xc000fd4fc0, 0xc000a49300)\n\t/opt/hostedtoolcache/go/1.16.9/x64/src/net/http/server.go:2049 +0x44\ngithub.com/cortezaproject/corteza-server/pkg/api.RemoteAddrToContext.func1(0x230ae00, 0xc000fd4fc0, 0xc000a49000)\n\t/home/runner/work/corteza-server/corteza-server/pkg/api/ipaddr.go:17 +0x1c7\nnet/http.HandlerFunc.ServeHTTP(0xc000532e40, 0x230ae00, 0xc000fd4fc0, 0xc000a49000)\n\t/opt/hostedtoolcache/go/1.16.9/x64/src/net/http/server.go:2049 +0x44\ngithub.com/go-chi/chi/middleware.RealIP.func1(0x230ae00, 0xc000fd4fc0, 0xc000a49000)\n\t/home/runner/go/pkg/mod/github.com/go-chi/chi@v3.3.4+incompatible/middleware/realip.go:34 +0x9d\nnet/http.HandlerFunc.ServeHTTP(0xc000532e58, 0x230ae00, 0xc000fd4fc0, 0xc000a49000)\n\t/opt/hostedtoolcache/go/1.16.9/x64/src/net/http/server.go:2049 +0x44\ngithub.com/cortezaproject/corteza-server/pkg/locale.DetectLanguage.func1.1(0x230ae00, 0xc000fd4fc0, 0xc000a48f00)\n\t/home/runner/work/corteza-server/corteza-server/pkg/locale/http.go:26 +0x371\nnet/http.HandlerFunc.ServeHTTP(0xc0001b1480, 0x230ae00, 0xc000fd4fc0, 0xc000a48f00)\n\t/opt/hostedtoolcache/go/1.16.9/x64/src/net/http/server.go:2049 +0x44\ngithub.com/go-chi/cors.(*Cors).Handler.func1(0x230ae00, 0xc000fd4fc0, 0xc000a48f00)\n\t/home/runner/go/pkg/mod/github.com/go-chi/cors@v1.0.0/cors.go:199 +0x183\nnet/http.HandlerFunc.ServeHTTP(0xc0001b1500, 0x230ae00, 0xc000fd4fc0, 0xc000a48f00)\n\t/opt/hostedtoolcache/go/1.16.9/x64/src/net/http/server.go:2049 +0x44\ngithub.com/cortezaproject/corteza-server/pkg/api/server.handlePanic.func1(0x230ae00, 0xc000fd4fc0, 0xc000a48f00)\n\t/home/runner/work/corteza-server/corteza-server/pkg/api/server/middleware.go:60 +0x7e\nnet/http.HandlerFunc.ServeHTTP(0xc000532e70, 0x230ae00, 0xc000fd4fc0, 0xc000a48f00)\n\t/opt/hostedtoolcache/go/1.16.9/x64/src/net/http/server.go:2049 +0x44\ngithub.com/getsentry/sentry-go/http.(*Handler).Handle.func1(0x230ae00, 0xc000fd4fc0, 0xc000a48e00)\n\t/home/runner/go/pkg/mod/github.com/getsentry/sentry-go@v0.1.1/http/sentryhttp.go:59 +0x337\nnet/http.HandlerFunc.ServeHTTP(0xc0001b1520, 0x230ae00, 0xc000fd4fc0, 0xc000a48e00)\n\t/opt/hostedtoolcache/go/1.16.9/x64/src/net/http/server.go:2049 +0x44\ngithub.com/go-chi/chi.(*Mux).ServeHTTP(0xc00051cc60, 0x230ae00, 0xc000fd4fc0, 0xc000a48e00)\n\t/home/runner/go/pkg/mod/github.com/go-chi/chi@v3.3.4+incompatible/mux.go:69 +0x50c\ngithub.com/go-chi/chi.(*Mux).Mount.func1(0x230ae00, 0xc000fd4fc0, 0xc000a48e00)\n\t/home/runner/go/pkg/mod/github.com/go-chi/chi@v3.3.4+incompatible/mux.go:291 +0x122\nnet/http.HandlerFunc.ServeHTTP(0xc0006d4260, 0x230ae00, 0xc000fd4fc0, 0xc000a48e00)\n\t/opt/hostedtoolcache/go/1.16.9/x64/src/net/http/server.go:2049 +0x44\ngithub.com/go-chi/chi.(*Mux).routeHTTP(0xc00051cc00, 0x230ae00, 0xc000fd4fc0, 0xc000a48e00)\n\t/home/runner/go/pkg/mod/github.com/go-chi/chi@v3.3.4+incompatible/mux.go:424 +0x28b\nnet/http.HandlerFunc.ServeHTTP(0xc0005a6850, 0x230ae00, 0xc000fd4fc0, 0xc000a48e00)\n\t/opt/hostedtoolcache/go/1.16.9/x64/src/net/http/server.go:2049 +0x44\ngithub.com/go-chi/chi.(*Mux).ServeHTTP(0xc00051cc00, 0x230ae00, 0xc000fd4fc0, 0xc000a48d00)\n\t/home/runner/go/pkg/mod/github.com/go-chi/chi@v3.3.4+incompatible/mux.go:81 +0x2d1\nnet/http.serverHandler.ServeHTTP(0xc0001ea000, 0x230ae00, 0xc000fd4fc0, 0xc000a48d00)\n\t/opt/hostedtoolcache/go/1.16.9/x64/src/net/http/server.go:2867 +0xa3\nnet/http.(*conn).serve(0xc000fa5ea0, 0x2313418, 0xc0003b8600)\n\t/opt/hostedtoolcache/go/1.16.9/x64/src/net/http/server.go:1932 +0x8cd\ncreated by net/http.(*Server).Serve\n\t/opt/hostedtoolcache/go/1.16.9/x64/src/net/http/server.go:2993 +0x39b\n"}

in debug console in chrome i didnt get any response. besides the payload, only 500 error is shown.

I hope you can help me

What version are you using?
From the stack trace there is something wrong with validation.

Can you export and send over the module in question?
There is an export button somewhere on the module editor screen.

Hi tjerman

My Version is: 2021.9

Here is the Module export (Im not allowed to upload, and the char limit is too low to paste so im linking the file)

Cool; thanks for the info.
I’ve opened up a ticket for someone to take a look at this.

Ive realized i was not on latest subversion, sorry for that.
on 21.9.6 its working again

2 Likes