UDM panic with v3.1.1

Hello, I tried to upgrade my v3.0.6 setup to v3.1.1 and have UDM crashing when UEs try to connect.
UDM logs are attached bellow.
I suspect the crash is related to this empty value in the AMF field here: 2022-05-25T09:50:25Z [TRAC][UDM][UEAU] RAND=[1874a174a6ef6ff894e6cad7e7979226], AMF=[].

Can someone confirm this or know how to fix this?

2022-05-25T09:50:20Z [INFO][UDM][App] UDM version:
        free5GC version: v3.1.1
        build time:      2022-05-24T08:34:33Z
        commit hash:     78f5c27d
        commit time:     2022-04-07T16:22:52Z
        go version:      go1.17.8 linux/amd64
2022-05-25T09:50:20Z [INFO][UDM][Init] UDM Config Info: Version[1.0.2] Description[UDM initial local configuration]
2022-05-25T09:50:20Z [INFO][UDM][Init] Server started
2022-05-25T09:50:20Z [INFO][UDM][Util] udmconfig Info: Version[1.0.2] Description[UDM initial local configuration]
2022-05-25T09:50:25Z [INFO][UDM][UEAU] Handle GenerateAuthDataRequest
2022-05-25T09:50:25Z [TRAC][UDM][UEAU] In GenerateAuthDataProcedure
2022-05-25T09:50:25Z [INFO][UDM][Suci] suciPart: [suci 0 001 01 0000 0 0 0000000000]
2022-05-25T09:50:25Z [INFO][UDM][Suci] scheme 0
2022-05-25T09:50:25Z [INFO][UDM][Suci] SUPI type is IMSI
2022-05-25T09:50:25Z [TRAC][UDM][UEAU] supi conversion => [imsi-001010000000000]
http://nrf.sbi-net:8000
2022-05-25T09:50:25Z [TRAC][UDM][UEAU] sqnStr 000000000000
2022-05-25T09:50:25Z [TRAC][UDM][UEAU] K=[8baf473f2f8fd09487cccbd7097c6862], sqn=[000000000000], OP=[8e27b6af0e692e750f32667a3b14605d], OPC=[8e27b6af0e692e750f32667a3b14605d]
2022-05-25T09:50:25Z [TRAC][UDM][UEAU] RAND=[1874a174a6ef6ff894e6cad7e7979226], AMF=[]
2022-05-25T09:50:25Z [ERRO][UDM][GIN] [Debugging] panic:
POST /nudm-ueau/v1/suci-0-001-01-0000-0-0-0000000000/security-information/generate-auth-data HTTP/2.0
Host: udm.sbi-net:8000
Accept: application/json
Accept-Encoding: gzip
Content-Length: 113
Content-Type: application/json
User-Agent: OpenAPI-Generator/1.0.0/go


runtime error: slice bounds out of range [:2] with capacity 0
goroutine 31 [running]:
runtime/debug.Stack()
        /usr/local/go/src/runtime/debug/stack.go:24 +0x65
github.com/free5gc/util/logger.ginRecover.func1.1()
        /go/pkg/mod/github.com/free5gc/[email protected]/logger/logger.go:212 +0x1a5
panic({0xa85e00, 0xc0001124c8})
        /usr/local/go/src/runtime/panic.go:1038 +0x215
github.com/free5gc/util/milenage.milenageF1({0xc0005b6700, 0x10, 0xc0000be588}, {0xc0005b66c0, 0x10, 0x20}, {0xc000171aa0, 0x10, 0x0}, {0xc000171ac0, ...}, ...)
        /go/pkg/mod/github.com/free5gc/[email protected]/milenage/milenage.go:44 +0x40f
github.com/free5gc/util/milenage.F1(...)
        /go/pkg/mod/github.com/free5gc/[email protected]/milenage/milenage.go:509
github.com/free5gc/udm/internal/sbi/producer.GenerateAuthDataProcedure({{0x0, 0x0}, {0xc00030a160, 0x20}, 0x0, {0xc0001040f0, 0x24}}, {0xc0005ee24e, 0x21})
        /go/src/free5gc/NFs/udm/internal/sbi/producer/generate_auth_data.go:464 +0x2188
github.com/free5gc/udm/internal/sbi/producer.HandleGenerateAuthDataRequest(0xc00001f800)
        /go/src/free5gc/NFs/udm/internal/sbi/producer/generate_auth_data.go:90 +0x185
github.com/free5gc/udm/internal/sbi/ueauthentication.HttpGenerateAuthData(0xc0005ec400)
        /go/src/free5gc/NFs/udm/internal/sbi/ueauthentication/api_generate_auth_data.go:59 +0x30f
github.com/free5gc/udm/internal/sbi/ueauthentication.genAuthDataHandlerFunc(0xc0005ec400)
        /go/src/free5gc/NFs/udm/internal/sbi/ueauthentication/routers.go:54 +0x1b5
github.com/gin-gonic/gin.(*Context).Next(...)
        /go/pkg/mod/github.com/gin-gonic/[email protected]/context.go:165
github.com/free5gc/util/logger.ginRecover.func1(0xc0005ec400)
        /go/pkg/mod/github.com/free5gc/[email protected]/logger/logger.go:244 +0x7b
github.com/gin-gonic/gin.(*Context).Next(...)
        /go/pkg/mod/github.com/gin-gonic/[email protected]/context.go:165
github.com/free5gc/util/logger.ginToLogrus.func1(0xc0005ec400)
        /go/pkg/mod/github.com/free5gc/[email protected]/logger/logger.go:179 +0x82
github.com/gin-gonic/gin.(*Context).Next(...)
        /go/pkg/mod/github.com/gin-gonic/[email protected]/context.go:165
github.com/gin-gonic/gin.(*Engine).handleHTTPRequest(0xc0004cf1e0, 0xc0005ec400)
        /go/pkg/mod/github.com/gin-gonic/[email protected]/gin.go:489 +0x63e
github.com/gin-gonic/gin.(*Engine).ServeHTTP(0xc0004cf1e0, {0xbb21e8, 0xc0005de008}, 0xc0005ec300)
        /go/pkg/mod/github.com/gin-gonic/[email protected]/gin.go:445 +0x1c5
golang.org/x/net/http2.(*serverConn).runHandler(0xc0005e80b0, 0xc0000c3fd0, 0x918b06, 0xc0005f8000)
        /go/pkg/mod/golang.org/x/[email protected]/http2/server.go:2158 +0x78
created by golang.org/x/net/http2.(*serverConn).processHeaders
        /go/pkg/mod/golang.org/x/[email protected]/http2/server.go:1888 +0x510
2022-05-25T09:50:25Z [INFO][UDM][GIN] | 500 |      10.0.211.5 | POST    | /nudm-ueau/v1/suci-0-001-01-0000-0-0-0000000000/security-information/generate-auth-data |
2022-05-25T09:50:26Z [INFO][UDM][UEAU] Handle GenerateAuthDataRequest
2022-05-25T09:50:26Z [TRAC][UDM][UEAU] In GenerateAuthDataProcedure
2022-05-25T09:50:26Z [INFO][UDM][Suci] suciPart: [suci 0 001 01 0000 0 0 0000000001]
2022-05-25T09:50:26Z [INFO][UDM][Suci] scheme 0
2022-05-25T09:50:26Z [INFO][UDM][Suci] SUPI type is IMSI
2022-05-25T09:50:26Z [TRAC][UDM][UEAU] supi conversion => [imsi-001010000000001]
http://nrf.sbi-net:8000
2022-05-25T09:50:26Z [TRAC][UDM][UEAU] sqnStr 000000000000
2022-05-25T09:50:26Z [TRAC][UDM][UEAU] K=[8baf473f2f8fd09487cccbd7097c6862], sqn=[000000000000], OP=[8e27b6af0e692e750f32667a3b14605d], OPC=[8e27b6af0e692e750f32667a3b14605d]
2022-05-25T09:50:26Z [TRAC][UDM][UEAU] RAND=[462ab64c4a4e35465c40e46d47e01b97], AMF=[]
2022-05-25T09:50:26Z [ERRO][UDM][GIN] [Debugging] panic:
POST /nudm-ueau/v1/suci-0-001-01-0000-0-0-0000000001/security-information/generate-auth-data HTTP/2.0
Host: udm.sbi-net:8000
Accept: application/json
Accept-Encoding: gzip
Content-Length: 113
Content-Type: application/json
User-Agent: OpenAPI-Generator/1.0.0/go


runtime error: slice bounds out of range [:2] with capacity 0
goroutine 84 [running]:
runtime/debug.Stack()
        /usr/local/go/src/runtime/debug/stack.go:24 +0x65
github.com/free5gc/util/logger.ginRecover.func1.1()
        /go/pkg/mod/github.com/free5gc/[email protected]/logger/logger.go:212 +0x1a5
panic({0xa85e00, 0xc00035acd8})
        /usr/local/go/src/runtime/panic.go:1038 +0x215
github.com/free5gc/util/milenage.milenageF1({0xc0005b6b80, 0x10, 0xc0002ec008}, {0xc0005b6b40, 0x10, 0x20}, {0xc000252700, 0x10, 0x0}, {0xc000252720, ...}, ...)
        /go/pkg/mod/github.com/free5gc/[email protected]/milenage/milenage.go:44 +0x40f
github.com/free5gc/util/milenage.F1(...)
        /go/pkg/mod/github.com/free5gc/[email protected]/milenage/milenage.go:509
github.com/free5gc/udm/internal/sbi/producer.GenerateAuthDataProcedure({{0x0, 0x0}, {0xc0005b6740, 0x20}, 0x0, {0xc000489f50, 0x24}}, {0xc0000c04ee, 0x21})
        /go/src/free5gc/NFs/udm/internal/sbi/producer/generate_auth_data.go:464 +0x2188
github.com/free5gc/udm/internal/sbi/producer.HandleGenerateAuthDataRequest(0xc0000945a0)
        /go/src/free5gc/NFs/udm/internal/sbi/producer/generate_auth_data.go:90 +0x185
github.com/free5gc/udm/internal/sbi/ueauthentication.HttpGenerateAuthData(0xc000494500)
        /go/src/free5gc/NFs/udm/internal/sbi/ueauthentication/api_generate_auth_data.go:59 +0x30f
github.com/free5gc/udm/internal/sbi/ueauthentication.genAuthDataHandlerFunc(0xc000494500)
        /go/src/free5gc/NFs/udm/internal/sbi/ueauthentication/routers.go:54 +0x1b5
github.com/gin-gonic/gin.(*Context).Next(...)
        /go/pkg/mod/github.com/gin-gonic/[email protected]/context.go:165
github.com/free5gc/util/logger.ginRecover.func1(0xc000494500)
        /go/pkg/mod/github.com/free5gc/[email protected]/logger/logger.go:244 +0x7b
github.com/gin-gonic/gin.(*Context).Next(...)
        /go/pkg/mod/github.com/gin-gonic/[email protected]/context.go:165
github.com/free5gc/util/logger.ginToLogrus.func1(0xc000494500)
        /go/pkg/mod/github.com/free5gc/[email protected]/logger/logger.go:179 +0x82
github.com/gin-gonic/gin.(*Context).Next(...)
        /go/pkg/mod/github.com/gin-gonic/[email protected]/context.go:165
github.com/gin-gonic/gin.(*Engine).handleHTTPRequest(0xc0004cf1e0, 0xc000494500)
        /go/pkg/mod/github.com/gin-gonic/[email protected]/gin.go:489 +0x63e
github.com/gin-gonic/gin.(*Engine).ServeHTTP(0xc0004cf1e0, {0xbb21e8, 0xc0000ae070}, 0xc0000fa500)
        /go/pkg/mod/github.com/gin-gonic/[email protected]/gin.go:445 +0x1c5
golang.org/x/net/http2.(*serverConn).runHandler(0xc0000bcb70, 0xc0000c9fd0, 0x918b06, 0xc0000a6780)
        /go/pkg/mod/golang.org/x/[email protected]/http2/server.go:2158 +0x78
created by golang.org/x/net/http2.(*serverConn).processHeaders
        /go/pkg/mod/golang.org/x/[email protected]/http2/server.go:1888 +0x510
2022-05-25T09:50:26Z [INFO][UDM][GIN] | 500 |      10.0.211.5 | POST    | /nudm-ueau/v1/suci-0-001-01-0000-0-0-0000000001/security-information/generate-auth-data |
2022-05-25T09:50:35Z [INFO][UDM][Init] Terminating UDM...
2022-05-25T09:50:35Z [INFO][UDM][Consumer] Send Deregister NFInstance
2022-05-25T09:50:36Z [INFO][UDM][Init] Deregister from NRF successfully
2022-05-25T09:50:36Z [INFO][UDM][Init] UDM terminated

I created an issue for this: https://github.com/free5gc/udm/issues/12.
A workaround is to change the Authentication Management Field in the database to something else (e.g. “8000”).