mautrix / whatsapp

A Matrix-WhatsApp puppeting bridge
https://maunium.net/go/mautrix-whatsapp
GNU Affero General Public License v3.0
1.29k stars 175 forks source link

panic: template: displayname:1:35: executing "displayname" at <.Jid>: can't evaluate field Jid in type *connector.DisplaynameParams #732

Closed kalon33 closed 1 month ago

kalon33 commented 1 month ago

Mautrix-whatapp has crashed after a few days running, and every restart leads to this crash in seconds:

panic: template: displayname:1:35: executing "displayname" at <.Jid>: can't evaluate field Jid in type *connector.DisplaynameParams

goroutine 155 [running]:
go.mau.fi/mautrix-whatsapp/pkg/connector.(*Config).FormatDisplayname(0x1ce1168, {{0xc00065ed40, 0xb}, 0x0, 0x0, 0x0, {0xc00065ed4c, 0xe}}, {0x1, {0x0, ...}, ...})
        /builds/mautrix/whatsapp/pkg/connector/config.go:151 +0x290
go.mau.fi/mautrix-whatsapp/pkg/connector.(*WhatsAppClient).contactToUserInfo(0xc000336d20, {{0xc00065ed40, 0xb}, 0x0, 0x0, 0x0, {0xc00065ed4c, 0xe}}, {0x1, {0x0, ...}, ...}, ...)
        /builds/mautrix/whatsapp/pkg/connector/userinfo.go:180 +0x185
go.mau.fi/mautrix-whatsapp/pkg/connector.(*WhatsAppClient).getUserInfo(0xc000336d20, {0x9e?, 0x1f4?}, {{0xc00065ed40, 0xb}, 0x0, 0x0, 0x0, {0xc00065ed4c, 0xe}}, ...)
        /builds/mautrix/whatsapp/pkg/connector/userinfo.go:172 +0x17b
go.mau.fi/mautrix-whatsapp/pkg/connector.(*WhatsAppClient).syncGhost(0xc000336d20, {{0xc00065ed40, 0xb}, 0x0, 0x0, 0x0, {0xc00065ed4c, 0xe}}, {0x12f62f4, 0xd}, ...)
        /builds/mautrix/whatsapp/pkg/connector/handlewhatsapp.go:475 +0x525
created by go.mau.fi/mautrix-whatsapp/pkg/connector.(*WhatsAppClient).handleWAEvent in goroutine 127
        /builds/mautrix/whatsapp/pkg/connector/handlewhatsapp.go:150 +0x545

Thanks for your help fixing this.

tulir commented 1 month ago

That sounds like your displayname_template was somehow corrupted. You can revert it to the one in the example or just manually fix it based on the docs in the comments